diff --git a/common/users/homeModules/scripts/default.nix b/common/users/homeModules/scripts/default.nix index b2aab75..5f5e623 100644 --- a/common/users/homeModules/scripts/default.nix +++ b/common/users/homeModules/scripts/default.nix @@ -21,7 +21,7 @@ in ../../../../customPackages ]; home = { - packages = with pkgs; [ + packages = [ # env for clipboard command will be required by their respective environemnts (mkScript { name = "paste"; @@ -34,12 +34,12 @@ in (mkScript { name = "http2ssh"; file = ./http2ssh.sh; - env = [git]; + env = [pkgs.git]; }) (mkScript { name = "git_fetchAll"; file = ./git_fetchAll.sh; - env = [git]; + env = [pkgs.git]; }) (mkScript { name = "install_eslint"; @@ -48,12 +48,17 @@ in (mkScript { name = "math"; file = ./math.sh; - env = [python3]; + env = [pkgs.python3]; }) (mkScript { name = "hashi18n"; file = ./hashi18n.sh; }) + (mkScript { + name = "flakeify"; + file = ./flakeify.sh; + deps = [pkgs.direnv]; + }) ]; file = { scripts = { diff --git a/common/users/homeModules/scripts/flakeify.sh b/common/users/homeModules/scripts/flakeify.sh new file mode 100644 index 0000000..79b98b1 --- /dev/null +++ b/common/users/homeModules/scripts/flakeify.sh @@ -0,0 +1,7 @@ +if [ ! -e flake.nix ]; then + nix flake new -t github:nix-community/nix-direnv . +elif [ ! -e .envrc ]; then + echo "use flake" > .envrc + direnv allow +fi +${EDITOR:-vim} flake.nix diff --git a/common/users/homeModules/zsh.nix b/common/users/homeModules/zsh.nix index 80acaf6..0a0792e 100644 --- a/common/users/homeModules/zsh.nix +++ b/common/users/homeModules/zsh.nix @@ -27,6 +27,13 @@ in }; }; programs = { + direnv = { + enable = true; + enableZshIntegration = true; + nix-direnv = { + enable = true; + }; + }; zoxide = { enable = true; enableZshIntegration = true; diff --git a/common/users/meyer/home.nix b/common/users/meyer/home.nix index c272f1b..b6685f0 100644 --- a/common/users/meyer/home.nix +++ b/common/users/meyer/home.nix @@ -1,9 +1,7 @@ { - config, - pkgs, - inputs, ... -}: { +}: +{ nixpkgs.config.allowInsecurePredicate = (pkg: true); nixpkgs.config.allowUnfreePredicate = (pkg: true); diff --git a/flake.lock b/flake.lock index 65a9869..e976430 100644 --- a/flake.lock +++ b/flake.lock @@ -244,6 +244,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -506,6 +524,18 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1733096140, + "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1730200266, @@ -541,6 +571,7 @@ "root": { "inputs": { "chrome-pak": "chrome-pak", + "flake-parts": "flake-parts", "home-manager": "home-manager", "home-manager-stable": "home-manager-stable", "nix-index-database": "nix-index-database", diff --git a/flake.nix b/flake.nix index fcb782c..358265a 100644 --- a/flake.nix +++ b/flake.nix @@ -37,112 +37,139 @@ url = "git+file:./customPackages/chrome-pak-customizer"; flake = false; }; + flake-parts.url = "github:hercules-ci/flake-parts"; }; outputs = - { self - , nixpkgs - , nixos-wsl - , nix-stable - , ... - }@inputs: - # let - # boxes = [ - # "default" - # ]; - # forAllSystems = nixpkgs.lib.genAttrs boxes; - # in { - nixosConfigurations = { - desktopIso = nixpkgs.lib.nixosSystem { - system = "aarch64-linux"; - modules = [ - ( - { pkgs - , modulesPath - , lib - , ... - }: + self, + nixpkgs, + nixos-wsl, + nix-stable, + flake-parts, + ... + }@inputs: + flake-parts.lib.mkFlake { inherit inputs; } { + debug = true; + systems = [ "x86_64-linux" ]; + perSystem = { config, ... }: { }; + flake = { + homeConfigurations = { + nixd = inputs.home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + modules = [ { - imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ]; - boot.kernelPackages = pkgs.linuxPackages_latest; - boot.supportedFilesystems = lib.mkForce [ - "btrfs" - "reiserfs" - "vfat" - "f2fs" - "xfs" - "ntfs" - "cifs" - "ext4" - ]; - } - ) - ]; - }; - nix-desktop-evo4b5 = nixpkgs.lib.nixosSystem rec { - specialArgs = { - inherit inputs; - stable = import nix-stable { - inherit system; - config = { - allowUnfree = true; - }; - }; - }; - system = "x86_64-linux"; - modules = [ - ( - { pkgs, ... }: - { - _module.args = { - unstable = pkgs; + home = { + stateVersion = "24.05"; + username = "nixd"; + homeDirectory = "/dev/null"; }; } - ) - ./boxes/desktop/configuration.nix - inputs.home-manager.nixosModules.default - inputs.nix-index-database.nixosModules.nix-index - { programs.nix-index-database.comma.enable = true; } - ]; + ( + { pkgs, ... }: + { + wayland.windowManager.hyprland.enable = true; + home = { + packages = with pkgs; [ nixd ]; + }; + } + ) + ]; + }; }; - arm-laptop-evo4b5 = nix-stable.lib.nixosSystem rec { - system = "aarch64-linux"; - specialArgs = { - inputs = inputs // { - nixpkgs = nix-stable; - home-manager = inputs.home-manager-stable; - stylix = inputs.stylix-stable; - }; - unstable = import nixpkgs { - inherit system; - config = { - allowUnfree = true; + nixosConfigurations = { + nixd = nixpkgs.lib.nixosSystem { }; + desktopIso = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + ( + { + pkgs, + modulesPath, + lib, + ... + }: + { + imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ]; + boot.kernelPackages = pkgs.linuxPackages_latest; + boot.supportedFilesystems = lib.mkForce [ + "btrfs" + "reiserfs" + "vfat" + "f2fs" + "xfs" + "ntfs" + "cifs" + "ext4" + ]; + } + ) + ]; + }; + nix-desktop-evo4b5 = nixpkgs.lib.nixosSystem rec { + specialArgs = { + inherit inputs; + stable = import nix-stable { + inherit system; + config = { + allowUnfree = true; + }; }; }; + system = "x86_64-linux"; + modules = [ + ( + { pkgs, ... }: + { + _module.args = { + unstable = pkgs; + }; + } + ) + ./boxes/desktop/configuration.nix + inputs.home-manager.nixosModules.default + inputs.nix-index-database.nixosModules.nix-index + { programs.nix-index-database.comma.enable = true; } + ]; }; - modules = [ - ( - { pkgs, ... }: - { - _module.args = { - stable = pkgs; + arm-laptop-evo4b5 = nix-stable.lib.nixosSystem rec { + system = "aarch64-linux"; + specialArgs = { + inputs = inputs // { + nixpkgs = nix-stable; + home-manager = inputs.home-manager-stable; + stylix = inputs.stylix-stable; + }; + unstable = import nixpkgs { + inherit system; + config = { + allowUnfree = true; }; - } - ) - ./boxes/wsl/configuration.nix - inputs.home-manager-stable.nixosModules.default - nixos-wsl.nixosModules.wsl - ]; + }; + }; + modules = [ + ( + { pkgs, ... }: + { + _module.args = { + stable = pkgs; + }; + } + ) + ./boxes/wsl/configuration.nix + inputs.home-manager-stable.nixosModules.default + nixos-wsl.nixosModules.wsl + ]; + }; }; + # nixosConfigurations.default = nixpkgs.lib.nixosSystem { + # specialArgs = {inherit inputs;}; + # modules = [ + # ./boxes/desktop/configuration.nix + # inputs.home-manager.nixosModules.default + # ]; + # }; + # cpkg = forAllSystems(system: import ./customPackages); }; - # nixosConfigurations.default = nixpkgs.lib.nixosSystem { - # specialArgs = {inherit inputs;}; - # modules = [ - # ./boxes/desktop/configuration.nix - # inputs.home-manager.nixosModules.default - # ]; - # }; - # cpkg = forAllSystems(system: import ./customPackages); }; }