Skyler Grey | 0409e46 | 2022-08-19 23:40:48 +0100 | [diff] [blame] | 1 | { |
| 2 | description = "Minion's NixOS configuration (since 2022-08-19)"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 3 | inputs = { |
| 4 | nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; |
Skyler Grey | 2f9904e | 2022-09-05 03:18:02 +0100 | [diff] [blame] | 5 | nixpkgs-minion.url = "github:Minion3665/nixpkgs"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 6 | flake-utils.url = "github:numtide/flake-utils"; |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 7 | vscode-extensions.url = "github:AmeerTaweel/nix-vscode-marketplace"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 8 | registry = { |
| 9 | url = "github:nixos/flake-registry"; |
| 10 | flake = false; |
| 11 | }; |
| 12 | home-manager.url = "github:nix-community/home-manager/release-22.05"; |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 13 | home-manager-unstable.url = "github:nix-community/home-manager"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 14 | sops-nix.url = "github:Mic92/sops-nix"; |
| 15 | impermanence.url = "github:nix-community/impermanence"; |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 16 | gtimelog = { |
| 17 | url = "git+https://gitlab.collabora.com/collabora/gtimelog.git"; |
| 18 | flake = false; |
| 19 | }; |
Skyler Grey | 934f142 | 2022-09-04 11:50:04 +0100 | [diff] [blame] | 20 | fzf-tab = { |
| 21 | url = "github:Aloxaf/fzf-tab"; |
| 22 | flake = false; |
| 23 | }; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 24 | |
Skyler Grey | 2f9904e | 2022-09-05 03:18:02 +0100 | [diff] [blame] | 25 | nixpkgs-minion.inputs.nixpkgs.follows = "nixpkgs"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 26 | home-manager.inputs.nixpkgs.follows = "nixpkgs"; |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 27 | home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs"; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 28 | sops-nix.inputs.nixpkgs.follows = "nixpkgs"; |
| 29 | impermanence.inputs.nixpkgs.follows = "nixpkgs"; |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 30 | }; |
Skyler Grey | 0409e46 | 2022-08-19 23:40:48 +0100 | [diff] [blame] | 31 | |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 32 | outputs = inputs: let |
| 33 | inherit (inputs) self nixpkgs flake-utils; |
| 34 | in |
Skyler Grey | 0409e46 | 2022-08-19 23:40:48 +0100 | [diff] [blame] | 35 | flake-utils.lib.eachDefaultSystem (system: let |
Skyler Grey | f649adf | 2022-08-26 06:47:44 +0100 | [diff] [blame] | 36 | pkgs = import nixpkgs { |
| 37 | inherit system; |
| 38 | overlays = import ./overlays nixpkgs.lib; |
| 39 | }; |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 40 | |
Skyler Grey | f649adf | 2022-08-26 06:47:44 +0100 | [diff] [blame] | 41 | utils = import ./utils nixpkgs.lib; |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 42 | |
| 43 | username = "minion"; |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 44 | |
| 45 | isAttrType = type: |
Skyler Grey | 1010db9 | 2022-09-05 03:21:48 +0100 | [diff] [blame] | 46 | if builtins.elem type.name ["submodule"] |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 47 | then true |
| 48 | else if type ? nestedTypes.elemType |
| 49 | then isAttrType type.nestedTypes.elemType |
| 50 | else false; |
| 51 | |
| 52 | normalizeOptions = options: |
| 53 | if |
| 54 | nixpkgs.lib.traceSeqN 2 { |
| 55 | inherit options; |
| 56 | type = builtins.typeOf options; |
| 57 | } |
| 58 | builtins.typeOf |
| 59 | options |
| 60 | == "set" |
| 61 | then |
| 62 | nixpkgs.lib.mapAttrs ( |
| 63 | name: value: |
| 64 | if |
| 65 | nixpkgs.lib.traceSeqN 3 { |
| 66 | inherit name value; |
| 67 | hasGetSubOpts = value ? getSubOptions; |
| 68 | hasType = value ? type; |
| 69 | isAttrType = value ? type && isAttrType value.type; |
| 70 | typeName = value.type.name or "unnamed"; |
| 71 | type = builtins.typeOf value; |
| 72 | } (builtins.typeOf value) |
| 73 | == "set" |
| 74 | then |
| 75 | nixpkgs.lib.traceVal (normalizeOptions ( |
| 76 | if value ? type && isAttrType value.type |
| 77 | then nixpkgs.lib.traceVal (value.type.getSubOptions []) |
| 78 | else nixpkgs.lib.traceVal value |
| 79 | )) |
| 80 | else value |
| 81 | ) |
| 82 | options |
| 83 | else options; |
Skyler Grey | 0409e46 | 2022-08-19 23:40:48 +0100 | [diff] [blame] | 84 | in { |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 85 | packages.nixosConfigurations = { |
| 86 | default = nixpkgs.lib.nixosSystem { |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 87 | inherit system; |
| 88 | |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 89 | modules = [ |
| 90 | (nixpkgs.lib.pipe ./modules [ |
| 91 | utils.nixFilesIn |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 92 | (utils.interpretNonstandardModule (args: |
| 93 | args |
| 94 | // { |
Skyler Grey | f649adf | 2022-08-26 06:47:44 +0100 | [diff] [blame] | 95 | home = args.config.home-manager.users.${username}; |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 96 | home-options = |
| 97 | nixpkgs.lib.traceVal (normalizeOptions |
| 98 | (args.options.home-manager.users.type.getSubOptions [])); |
| 99 | inherit system; |
Skyler Grey | bcb2cb7 | 2022-08-21 07:24:35 +0100 | [diff] [blame] | 100 | })) |
| 101 | ]) |
Skyler Grey | f649adf | 2022-08-26 06:47:44 +0100 | [diff] [blame] | 102 | { |
| 103 | minion = import ./config.nix; |
| 104 | } |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 105 | ]; |
| 106 | |
Skyler Grey | 2a7ca38 | 2022-09-01 23:15:31 +0100 | [diff] [blame] | 107 | specialArgs = inputs // {inherit username;}; |
Skyler Grey | 7dfe5c6 | 2022-08-20 21:41:30 +0100 | [diff] [blame] | 108 | }; |
| 109 | }; |
Skyler Grey | 0409e46 | 2022-08-19 23:40:48 +0100 | [diff] [blame] | 110 | devShell = pkgs.mkShell { |
| 111 | nativeBuildInputs = with pkgs; [nodePackages.prettier alejandra]; |
| 112 | buildInputs = []; |
| 113 | }; |
| 114 | formatter = pkgs.alejandra; |
| 115 | }); |
| 116 | } |