From 1326dc61a827c72cb1c7a172b9cb4f4b96334a1d Mon Sep 17 00:00:00 2001 From: Greg Hellings Date: Sun, 17 Apr 2022 22:29:13 -0500 Subject: [PATCH] Convert to flake instead of raw --- .gitignore | 1 - configuration.nix | 15 ----- flake.lock | 62 +++++++++++++++++++++ flake.nix | 31 +++++++++++ hosts/2maccabees/default.nix | 1 + hosts/2maccabees/hardware-configuration.nix | 31 +++++++++++ base.nix => profiles/base.nix | 4 +- 7 files changed, 127 insertions(+), 18 deletions(-) delete mode 100644 configuration.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100755 hosts/2maccabees/hardware-configuration.nix rename base.nix => profiles/base.nix (96%) diff --git a/.gitignore b/.gitignore index 51c610f..c70dc2d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ host -hardware-configuration.nix diff --git a/configuration.nix b/configuration.nix deleted file mode 100644 index 44f5a76..0000000 --- a/configuration.nix +++ /dev/null @@ -1,15 +0,0 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - -{ config, pkgs, ... }: - -{ - imports = - [ # Include the results of the hardware scan. - "${builtins.fetchTarball "https://github.com/ryantm/agenix/archive/0.10.1.tar.gz"}/modules/age.nix" - ./hardware-configuration.nix - ./base.nix - ./host - ]; -} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a898f60 --- /dev/null +++ b/flake.lock @@ -0,0 +1,62 @@ +{ + "nodes": { + "agenix": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1648942457, + "narHash": "sha256-i29Z1t3sVfCNfpp+KAfeExvpqHQSbLO1KWylTtfradU=", + "owner": "ryantm", + "repo": "agenix", + "rev": "0d5e59ed645e4c7b60174bc6f6aac6a203dc0b01", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1638587357, + "narHash": "sha256-2ySMW3QARG8BsRPmwe7clTbdCuaObromOKewykP+UJc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e34c5379866833f41e2a36f309912fa675d687c7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-21.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1650143261, + "narHash": "sha256-KI3IDHAtXG/7Uu1gNuuy6ovKqP/d6OhV0HwCWIKx0Aw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0a862f558d4001c62f15f652b1b907002dc1e9b9", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-21.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "agenix": "agenix", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..61f04b9 --- /dev/null +++ b/flake.nix @@ -0,0 +1,31 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). +{ + description = "Greg's machines!"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11"; + agenix.url = "github:ryantm/agenix"; + }; + + outputs = inputs: + let + mods = hostname: [ + inputs.agenix.nixosModule + ./profiles/base.nix + ./hosts/${hostname} + ]; + in { + nixosConfigurations = { + "2maccabees" = inputs.nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + specialArgs = { + nixpkgs = inputs.nixpkgs; + agenix = inputs.agenix; + }; + modules = mods "2maccabees"; + }; + }; + }; +} diff --git a/hosts/2maccabees/default.nix b/hosts/2maccabees/default.nix index ff24512..951b96f 100644 --- a/hosts/2maccabees/default.nix +++ b/hosts/2maccabees/default.nix @@ -2,6 +2,7 @@ { imports = [ + ./hardware-configuration.nix ./dnsmasq.nix ./home-assistant.nix ./networking.nix diff --git a/hosts/2maccabees/hardware-configuration.nix b/hosts/2maccabees/hardware-configuration.nix new file mode 100755 index 0000000..50db628 --- /dev/null +++ b/hosts/2maccabees/hardware-configuration.nix @@ -0,0 +1,31 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" "uas" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/35f9a49a-b557-4eb3-a013-2afca7a990e4"; + fsType = "btrfs"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/A982-C8A3"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/4b6f2dc4-d845-4ec4-81f2-4f61bb3f282d"; } + ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; +} diff --git a/base.nix b/profiles/base.nix similarity index 96% rename from base.nix rename to profiles/base.nix index 130451d..9872ae4 100755 --- a/base.nix +++ b/profiles/base.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, agenix, ... }: let syncs = [ @@ -73,7 +73,7 @@ in # Base packages that need to be in all my hosts environment.systemPackages = with pkgs; [ - (pkgs.callPackage "${builtins.fetchTarball "https://github.com/ryantm/agenix/archive/0.10.1.tar.gz"}/pkgs/agenix.nix" {}) + agenix.defaultPackage."${system}" git home-manager htop