diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..bc1ac20 --- /dev/null +++ b/flake.lock @@ -0,0 +1,350 @@ +{ + "nodes": { + "devshell": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717408969, + "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=", + "owner": "numtide", + "repo": "devshell", + "rev": "1ebbe68d57457c8cae98145410b164b5477761f4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1718242063, + "narHash": "sha256-n3AWItJ4a94GT0cray/eUV7tt3mulQ52L+lWJN9d1E8=", + "owner": "nix-community", + "repo": "disko", + "rev": "832a9f2c81ff3485404bd63952eadc17bf7ccef2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, + "flake-compat": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717285511, + "narHash": "sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat_2", + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717664902, + "narHash": "sha256-7XfBuLULizXjXfBYy/VV+SpYMHreNRHk9nKMsm1bgb4=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "cc4d466cb1254af050ff7bdf47f6d404a7c646d1", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "hardware": { + "locked": { + "lastModified": 1718429294, + "narHash": "sha256-uhKuPVN8IZJCWwFhNupTxES7LMo8ot2KC6+VmVWwzyU=", + "owner": "nixos", + "repo": "nixos-hardware", + "rev": "239c3864fef6292262d23cff58ce81674f309142", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixos-hardware", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717527182, + "narHash": "sha256-vWSkg6AMok1UUQiSYVdGMOXKD2cDFnajITiSi0Zjd1A=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "845a5c4c073f74105022533907703441e0464bc3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.05", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1718243258, + "narHash": "sha256-abBpj2VU8p6qlRzTU8o22q68MmOaZ4v8zZ4UlYl5YRU=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "8d5e27b4807d25308dfe369d5a923d87e7dbfda3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1718345812, + "narHash": "sha256-FJhA+YFsOFrAYe6EaiTEfomNf7jeURaPiG5/+a3DRSc=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "ff988d78f2f55641efacdf9a585d2937f7e32a9b", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1718554853, + "narHash": "sha256-1QeIFIz/rhOE5ksY++0Pqurnd/YL1iuxw3vKHxOiSv4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a039c9721c0d08e8fc7d1b4210a56d68cd6dee64", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1718318537, + "narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "git-hooks": "git-hooks", + "home-manager": "home-manager_2", + "nix-darwin": "nix-darwin", + "nixpkgs": [ + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1718395224, + "narHash": "sha256-CHb6PztVli8qtAnXTR+VcB+6CANs+TkIz1Ivu8yXsvM=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "a4dec356e736f795f8eec2d6f1580b4769f2fe21", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "nixos-24.05", + "repo": "nixvim", + "type": "github" + } + }, + "root": { + "inputs": { + "disko": "disko", + "hardware": "hardware", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1718271476, + "narHash": "sha256-35hUMmFesmchb+u7heKHLG5B6c8fBOcSYo0jj0CHLes=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "e75ba0a6bb562d2ce275db28f6a36a2e4fd81391", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index c483e71..fcdfabb 100644 --- a/flake.nix +++ b/flake.nix @@ -1,13 +1,162 @@ { + description = "Madmin's system's nix Config"; + + # ===================================================================== # + # ============================== INPUTS =============================== # + # ===================================================================== # inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - disko.url = "github:nix-community/disko"; - disko.inputs.nixpkgs.follows = "nixpkgs"; - }; - outputs = { self, nixpkgs, disko }: { - nixosConfigurations.jeroboam = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ ./configuration.nix disko.nixosModules.disko ]; + # ============= Official NixOS and HM Package Sources ============= # + + nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # also see 'unstable-packages' overlay at 'overlays/default.nix" + + hardware.url = "github:nixos/nixos-hardware"; + + home-manager = { + url = "github:nix-community/home-manager/release-24.05"; + inputs.nixpkgs.follows = "nixpkgs"; }; + + # =========================== Utilities =========================== # + + # -------------------------- Lanzaboote --------------------------- # + #lanzabote = { + # url = "github:nix-community/lanzaboote"; + # inputs.nixpkgs.follows = "unstable"; + #}; + + # ------------ Declarative partitioning and formatting ------------ # + disko = { + url = "github:nix-community/disko"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # ------------- Secrets mngmt. C ./docs/secretsmgmt.md ------------ # + #sops-nix = { + # url = "github:mic92/sops-nix"; + # inputs.nixpkgs.follows = "nixpkgs"; + #}; + + # ------------------------------ VIM ------------------------------ # + nixvim = { + url = "github:nix-community/nixvim/nixos-24.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # ------------------------ Windows manager ------------------------ # + # TODO + #hyprland = { + # url = "github:hyprwm/hyprland"; + # inputs.nixpkgs.follows = "nixpkgs"; + #}; + #hyprland-plugins = { + # url = "github:hyprwm/hyprland-plugins"; + # inputs.hyprland.follows = "hyprland"; + #}; + #hyprland-themes = { + # url = "github:hyprwm/hyprland-themes"; + # inputs.hyprland.follows = "hyprland"; + #}; + # ------------------------------ ZSH ------------------------------ # + #nix-zsh-completions = { + # url = "github:nix-community/nix-zsh-completions"; + # inputs.nixpkgs.follows = "nixpkgs"; + #}; + # -------------------------- Nix-Colors --------------------------- # + # TODO + # https://github.com/Misterio77/nix-colors + #nix-colors = { + # url = "github:misterio77/nix-colors"; + # inputs.nixpkgs.follows = "nixpkgs"; + #}; + # ====================== Personal Repositories ====================== # + + # Private secrets repo. See ./docs/secretsmgmt.md + # Authenticate via ssh and use shallow clone + #nix-secrets = { + # url = "git+ssh://git@gitlab.com/emergentmind/nix-secrets.git?ref=main&shallow=1"; + # flake = false; + #}; + }; + + # ===================================================================== # + # ============================== OUTPUTS ============================== # + # ===================================================================== # + outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, disko, ... }@ inputs: + let + inherit (self) outputs; + forAllSystems = nixpkgs.lib.genAttrs [ + "x86_64-linux" + "aarch64-linux" + ]; + inherit (nixpkgs) lib; + configVars = import ./vars { inherit inputs lib; }; + configLib = import ./lib { inherit lib; }; + specialArgs = { inherit inputs outputs configVars configLib nixpkgs; }; + in rec + { + # ============================ CUSTOM ============================= # + # ---------------------------- Modules ---------------------------- # + # Custom modules to enable special functionality for nixos or home-manager oriented configs. + nixosModules = import ./modules/nixos; + homeManagerModules = import ./modules/home-manager; + + # ---------------------------- Overlays --------------------------- # + # Custom modifications/overrides to upstream packages. + overlays = import ./overlays { inherit inputs outputs; }; + + # ---------------------------- Packages --------------------------- # + # Custom packages to be shared or upstreamed. + packages = forAllSystems (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + import ./pkgs { inherit pkgs; } + ); + + # ============================= Tools ============================= # + # --------------------------- Formatter --------------------------- # + # Nix formatter available through 'nix fmt' https://nix-community.github.io/nixpkgs-fmt + formatter = forAllSystems + (system: + nixpkgs.legacyPackages.${system}.nixpkgs-fmt + ); + + # -------------------------- INIT Shell -------------------------- # + # Devshell for bootstrapping + # Acessible through 'nix develop' or 'nix-shell' (legacy) + # Shell configured with packages that are typically only needed when working on or with nix-config. + devShells = forAllSystems (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + import ./shell.nix { inherit pkgs; inherit packages; } + ); + + # ======================= Nixos Configurations ========================== # + # + # Building configurations available through `just rebuild` or `nixos-rebuild --flake .#hostname` + nixosConfigurations = { + # Jedidiah - the + # jedidiah + # TODO: The one who listened too much + #rehoboam = lib.nixosSystem { + # modules = [ ./system/rehoboam ]; + # specialArgs = { inherit inputs outputs;}; + #}; + + # The rebel who worships the golden calf + jeroboam = lib.nixosSystem { + inherit specialArgs; + modules = [ + home-manager.nixosModules.home-manager{ + home-manager.extraSpecialArgs = specialArgs; + } + ./systems/jeroboam + ]; + }; + }; + }; } +