| { |
| description = "Minion's NixOS configuration (since 2022-08-19)"; |
| inputs = { |
| nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; |
| nixpkgs-minion.url = "github:Minion3665/nixpkgs"; |
| flake-utils.url = "github:numtide/flake-utils"; |
| flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus"; |
| vscode-extensions.url = "github:AmeerTaweel/nix-vscode-marketplace"; |
| registry = { |
| url = "github:nixos/flake-registry"; |
| flake = false; |
| }; |
| home-manager.url = "github:nix-community/home-manager/release-22.05"; |
| home-manager-unstable.url = "github:nix-community/home-manager"; |
| sops-nix.url = "github:Mic92/sops-nix"; |
| impermanence.url = "github:nix-community/impermanence"; |
| gtimelog = { |
| url = "git+https://gitlab.collabora.com/collabora/gtimelog.git"; |
| flake = false; |
| }; |
| fzf-tab = { |
| url = "github:Aloxaf/fzf-tab"; |
| flake = false; |
| }; |
| |
| nixpkgs-minion.inputs.nixpkgs.follows = "nixpkgs"; |
| flake-utils-plus.inputs.flake-utils.follows = "flake-utils"; |
| home-manager.inputs.nixpkgs.follows = "nixpkgs"; |
| home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs"; |
| sops-nix.inputs.nixpkgs.follows = "nixpkgs"; |
| impermanence.inputs.nixpkgs.follows = "nixpkgs"; |
| }; |
| |
| outputs = inputs: let |
| inherit (inputs) self nixpkgs flake-utils; |
| in |
| flake-utils.lib.eachDefaultSystem (system: let |
| pkgs = import nixpkgs { |
| inherit system; |
| overlays = import ./overlays nixpkgs.lib; |
| }; |
| |
| utils = import ./utils nixpkgs.lib; |
| |
| username = "minion"; |
| |
| isAttrType = type: |
| if builtins.elem type.name ["submodule"] |
| then true |
| else if type ? nestedTypes.elemType |
| then isAttrType type.nestedTypes.elemType |
| else false; |
| |
| normalizeOptions = options: |
| if |
| nixpkgs.lib.traceSeqN 2 { |
| inherit options; |
| type = builtins.typeOf options; |
| } |
| builtins.typeOf |
| options |
| == "set" |
| then |
| nixpkgs.lib.mapAttrs ( |
| name: value: |
| if |
| nixpkgs.lib.traceSeqN 3 { |
| inherit name value; |
| hasGetSubOpts = value ? getSubOptions; |
| hasType = value ? type; |
| isAttrType = value ? type && isAttrType value.type; |
| typeName = value.type.name or "unnamed"; |
| type = builtins.typeOf value; |
| } (builtins.typeOf value) |
| == "set" |
| then |
| nixpkgs.lib.traceVal (normalizeOptions ( |
| if value ? type && isAttrType value.type |
| then nixpkgs.lib.traceVal (value.type.getSubOptions []) |
| else nixpkgs.lib.traceVal value |
| )) |
| else value |
| ) |
| options |
| else options; |
| in { |
| packages.nixosConfigurations = { |
| default = nixpkgs.lib.nixosSystem { |
| inherit system; |
| |
| modules = [ |
| (nixpkgs.lib.pipe ./modules [ |
| utils.nixFilesIn |
| (utils.interpretNonstandardModule (args: |
| args |
| // { |
| home = args.config.home-manager.users.${username}; |
| home-options = |
| nixpkgs.lib.traceVal (normalizeOptions |
| (args.options.home-manager.users.type.getSubOptions [])); |
| inherit system utils; |
| })) |
| ]) |
| { |
| minion = import ./config.nix; |
| } |
| ]; |
| |
| specialArgs = inputs // {inherit inputs username;}; |
| }; |
| }; |
| devShell = pkgs.mkShell { |
| nativeBuildInputs = with pkgs; [nodePackages.prettier alejandra]; |
| buildInputs = []; |
| }; |
| formatter = pkgs.alejandra; |
| }); |
| } |