diff options
author | Adrian Kummerlaender | 2021-08-19 12:10:30 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2021-08-19 23:40:42 +0200 |
commit | a468935722b85beef588ab313f2adfe0159564e2 (patch) | |
tree | 1eae65d063843d6712a6a4d4d46546623d1f875e | |
parent | 725db6480cbac8a8e9da1b527bd391ec3d64f5b6 (diff) | |
download | nixos_system-a468935722b85beef588ab313f2adfe0159564e2.tar nixos_system-a468935722b85beef588ab313f2adfe0159564e2.tar.gz nixos_system-a468935722b85beef588ab313f2adfe0159564e2.tar.bz2 nixos_system-a468935722b85beef588ab313f2adfe0159564e2.tar.lz nixos_system-a468935722b85beef588ab313f2adfe0159564e2.tar.xz nixos_system-a468935722b85beef588ab313f2adfe0159564e2.tar.zst nixos_system-a468935722b85beef588ab313f2adfe0159564e2.zip |
Basic flakeification
-rw-r--r-- | configuration.nix | 37 | ||||
-rw-r--r-- | flake.lock | 63 | ||||
-rw-r--r-- | flake.nix | 31 |
3 files changed, 115 insertions, 16 deletions
diff --git a/configuration.nix b/configuration.nix index 868d6cf..73138f6 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,13 +1,9 @@ -{ config, pkgs, ... }: - -let - mypkgs = import <mypkgs> { }; - -in { +{ config, pkgs, pkgs-personal, hostname, ... }: +{ imports = [ ./fish.nix - ./host/current.nix ./user/common.nix + (./host + ("/" + hostname + ".nix")) ]; console.keyMap = "de"; @@ -20,7 +16,16 @@ in { nixpkgs.config.allowUnfree = true; - nix.allowedUsers = [ "common" ]; + nix = { + package = pkgs.nixUnstable; + + allowedUsers = [ "common" ]; + trustedUsers = [ "root" "common" ]; + + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; networking.nameservers = [ "1.1.1.1" @@ -43,14 +48,14 @@ in { }; environment = { - systemPackages = [ - pkgs.psmisc - pkgs.htop - pkgs.git - pkgs.p7zip - pkgs.silver-searcher - pkgs.renameutils - mypkgs.custom-neovim + systemPackages = with pkgs; [ + psmisc + htop + git + p7zip + silver-searcher + renameutils + pkgs-personal.custom-neovim ]; variables = { diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9fa27ba --- /dev/null +++ b/flake.lock @@ -0,0 +1,63 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1629271619, + "narHash": "sha256-by9D3OkEKk4rOzJIMbC0uP2wP3Bt81auP5xmbmPg2a8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7bbca9877caed472c6b5866ea09302cfcdce3dbf", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-21.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1629271619, + "narHash": "sha256-by9D3OkEKk4rOzJIMbC0uP2wP3Bt81auP5xmbmPg2a8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7bbca9877caed472c6b5866ea09302cfcdce3dbf", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-21.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "pkgs-personal": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1629367653, + "narHash": "sha256-TYovgHylzgcVC7M714mPVdCCsnHV9Uh2DiLWhi/KWe8=", + "owner": "KnairdA", + "repo": "pkgs", + "rev": "5e27bc6838920fe2948bc0953a519232bced0397", + "type": "github" + }, + "original": { + "owner": "KnairdA", + "ref": "master", + "repo": "pkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "pkgs-personal": "pkgs-personal" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..37a54de --- /dev/null +++ b/flake.nix @@ -0,0 +1,31 @@ +{ + description = "System environment of Adrian Kummerlaender"; + + inputs = { + nixpkgs.url = github:NixOS/nixpkgs/nixos-21.05; + pkgs-personal.url = github:KnairdA/pkgs/master; + }; + + outputs = { self, nixpkgs, pkgs-personal, ... }: let + config = hostname: nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit pkgs-personal; + inherit hostname; + }; + modules = [ ./configuration.nix ]; + }; + + hostnames = builtins.map + (h: builtins.replaceStrings [ ".nix" ] [ "" ] h) + (builtins.filter + (h: h != "") + (nixpkgs.lib.mapAttrsToList + (name: type: if type == "regular" then name else "") + (builtins.readDir ./host))); + + in { + nixosConfigurations = builtins.listToAttrs + (map (h: { name = h; value = config h; }) hostnames); + }; +} |