diff --git a/flake.lock b/flake.lock index 0071275..523ea0f 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "impermanence": { + "locked": { + "lastModified": 1611747548, + "narHash": "sha256-2z5wmWda1uI4IkTZrW52jiHq3bzhYLc+GgjvaSd544M=", + "owner": "nix-community", + "repo": "impermanence", + "rev": "58558845bc68dcf2bb32caa80564f7fe3f6cbc61", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "impermanence", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1628607662, @@ -17,6 +32,7 @@ }, "root": { "inputs": { + "impermanence": "impermanence", "nixpkgs": "nixpkgs", "unstable": "unstable" } diff --git a/flake.nix b/flake.nix index cf4cfac..458bd43 100644 --- a/flake.nix +++ b/flake.nix @@ -1,10 +1,13 @@ { inputs.nixpkgs.url = "nixpkgs/nixos-21.05"; inputs.unstable.url = "nixpkgs/nixos-unstable"; + inputs.impermanence.url = "github:nix-community/impermanence"; - outputs = { self, nixpkgs, ... }@inputs: + outputs = { self, nixpkgs, impermanence, ... }@inputs: { nixosModules = { + inherit (impermanence.nixosModules) impermanence; + baseline = import ./modules/baseline.nix; cli = import ./modules/cli.nix; gnome = import ./modules/gnome.nix; diff --git a/hosts/nixdev/configuration.nix b/hosts/nixdev/configuration.nix new file mode 100644 index 0000000..ef53a07 --- /dev/null +++ b/hosts/nixdev/configuration.nix @@ -0,0 +1,43 @@ +{ ... }: +{ + sconfig = { + profile = "server"; + }; + + environment.persistence."/nix/persist" = { + files = [ + "/etc/machine-id" + "/etc/ssh/ssh_host_ed25519_key.pub" + "/etc/ssh/ssh_host_ed25519_key" + "/etc/ssh/ssh_host_rsa_key.pub" + "/etc/ssh/ssh_host_rsa_key" + ]; + directories = [ + "/home" + "/var/log" + ]; + }; + + security.sudo.wheelNeedsPassword = false; + + boot = { + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; + }; + + networking = { + useDHCP = false; + interfaces.enp6s18.ipv4.addresses = [{ address = "10.5.7.160"; prefixLength = 24; }]; + defaultGateway = "10.5.7.1"; + nameservers = [ "1.1.1.1" ]; + }; + + fileSystems = + { + "/" = { device = "tmpfs"; fsType = "tmpfs"; options = [ "mode=755" ]; }; + "/boot" = { device = "/dev/disk/by-partlabel/_esp"; fsType = "vfat"; options = [ "discard" "noatime" ]; }; + "/nix" = { device = "/dev/disk/by-partlabel/_nix"; fsType = "ext4"; options = [ "discard" "noatime" ]; }; + }; + + system.stateVersion = "21.05"; +} diff --git a/hosts/nixdev/default.nix b/hosts/nixdev/default.nix new file mode 100644 index 0000000..165044d --- /dev/null +++ b/hosts/nixdev/default.nix @@ -0,0 +1,6 @@ +{ + pkgs = "nixpkgs"; + system = "x86_64-linux"; + hardware = "qemu"; + module = ./configuration.nix; +}