diff --git a/flake.lock b/flake.lock index 45eecd7..cb1e359 100644 --- a/flake.lock +++ b/flake.lock @@ -39,11 +39,11 @@ ] }, "locked": { - "lastModified": 1748875655, - "narHash": "sha256-13VVGRq/F4O+39qQzgfUoqn26lDbNtF5gYavAysXHiE=", + "lastModified": 1750097069, + "narHash": "sha256-MePLDJw4megMq47O3WXgmpnDOIaQrHYrgA3xS7Ps+c8=", "owner": "cachix", "repo": "devenv", - "rev": "b5e62f9a9edfca90094041698626e14cacbcf72e", + "rev": "ab8a1563714393d366b2db7d93f021afb45e7a6f", "type": "github" }, "original": { @@ -178,11 +178,32 @@ ] }, "locked": { - "lastModified": 1748830238, - "narHash": "sha256-EB+LzYHK0D5aqxZiYoPeoZoOzSAs8eqBDxm3R+6wMKU=", + "lastModified": 1750099781, + "narHash": "sha256-6EVPi3XzioPzwxLZ/2nD6jbKCLA2ZXRdOWFgHg2ozrA=", "owner": "nix-community", "repo": "home-manager", - "rev": "c7fdb7e90bff1a51b79c1eed458fb39e6649a82a", + "rev": "1db3cb415da14c81d8e0fdd3a5edeba82ad13a1f", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nix-home", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1750033262, + "narHash": "sha256-TcFN78w6kPspxpbPsxW/8vQ1GAtY8Y3mjBaC+oB8jo4=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "66523b0efe93ce5b0ba96dcddcda15d36673c1f0", "type": "github" }, "original": { @@ -240,6 +261,27 @@ "type": "github" } }, + "nix-home": { + "inputs": { + "home-manager": "home-manager_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1750100488, + "narHash": "sha256-WFY6/1AtATVloT/takLMt6/0RNx2ivU1ZXG4Pn64/eA=", + "ref": "refs/heads/main", + "rev": "696f5a00078b39c9ca81802170924c4647ffd5a1", + "revCount": 16, + "type": "git", + "url": "https://gitea.john-stream.com/john/nix-home" + }, + "original": { + "type": "git", + "url": "https://gitea.john-stream.com/john/nix-home" + } + }, "nixpkgs": { "locked": { "lastModified": 1733212471, @@ -264,11 +306,11 @@ ] }, "locked": { - "lastModified": 1746223523, - "narHash": "sha256-BH27BJZNbR0zQAL/mFCxDPR6K6mbrmjJ66lxVDTNPXU=", + "lastModified": 1749760516, + "narHash": "sha256-koLwnVjVrR4yS2ea1owMj6ps2sOhH67ObTIld9H27Yo=", "owner": "cachix", "repo": "nixpkgs-python", - "rev": "3f5f1dbe0122a1741907aa5ab76f7337ffcd2ccb", + "rev": "908dbb466af5955ea479ac95953333fd64387216", "type": "github" }, "original": { @@ -295,11 +337,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1748693115, - "narHash": "sha256-StSrWhklmDuXT93yc3GrTlb0cKSS0agTAxMGjLKAsY8=", + "lastModified": 1749794982, + "narHash": "sha256-Kh9K4taXbVuaLC0IL+9HcfvxsSUx8dPB5s5weJcc9pc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "910796cabe436259a29a72e8d3f5e180fc6dfacc", + "rev": "ee930f9755f58096ac6e8ca94a1887e0534e2d81", "type": "github" }, "original": { @@ -327,6 +369,7 @@ "inputs": { "devenv": "devenv", "home-manager": "home-manager", + "nix-home": "nix-home", "nixpkgs": "nixpkgs_3", "nixpkgs-python": "nixpkgs-python", "sops-nix": "sops-nix", @@ -340,11 +383,11 @@ ] }, "locked": { - "lastModified": 1747603214, - "narHash": "sha256-lAblXm0VwifYCJ/ILPXJwlz0qNY07DDYdLD+9H+Wc8o=", + "lastModified": 1749592509, + "narHash": "sha256-VunQzfZFA+Y6x3wYi2UE4DEQ8qKoAZZCnZPUlSoqC+A=", "owner": "Mic92", "repo": "sops-nix", - "rev": "8d215e1c981be3aa37e47aeabd4e61bb069548fd", + "rev": "50754dfaa0e24e313c626900d44ef431f3210138", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 1ed03ca..d411dcf 100644 --- a/flake.nix +++ b/flake.nix @@ -18,6 +18,10 @@ url = "github:cachix/devenv"; inputs.nixpkgs.follows = "nixpkgs"; }; + nix-home = { + url = "git+https://gitea.john-stream.com/john/nix-home"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; nixConfig = { @@ -25,10 +29,10 @@ extra-substituters = "https://devenv.cachix.org"; }; - outputs = { self, ... }@args: + outputs = { self, ... }@inputs: let inherit (self) outputs; - nixosSystem = args.nixpkgs.lib.nixosSystem; + nixosSystem = inputs.nixpkgs.lib.nixosSystem; userSettings = { gitUserName = "John Lancaster"; @@ -46,26 +50,23 @@ # pythonVersion = "3.11.10"; # This is largely irrelevant because uv will handle it }; - pkgs = args.nixpkgs.legacyPackages.${systemSettings.system}; + pkgs = inputs.nixpkgs.legacyPackages.${systemSettings.system}; in { nixosConfigurations.${systemSettings.hostName} = nixosSystem { system = systemSettings.system; - specialArgs = - let - inputs = args; - in - { + specialArgs = { inherit inputs; inherit systemSettings; inherit userSettings; }; modules = [ - (args.nixpkgs + "/nixos/modules/virtualisation/proxmox-lxc.nix") - args.home-manager.nixosModules.default - args.vscode-server.nixosModules.default - args.sops-nix.nixosModules.sops + (inputs.nixpkgs + "/nixos/modules/virtualisation/proxmox-lxc.nix") + inputs.home-manager.nixosModules.default + inputs.nix-home.nixosModules.default { user = "appdaemon"; } + inputs.vscode-server.nixosModules.default + inputs.sops-nix.nixosModules.sops ./configuration.nix ]; }; @@ -76,71 +77,67 @@ devenv-test = self.devShells.${systemSettings.system}.default.config.test; }; - devShells.${systemSettings.system}.default = - let - inputs = args; - in - args.devenv.lib.mkShell { - inherit inputs pkgs; - modules = [ - ({ pkgs, config, ... }: { - # This is your devenv configuration + devShells.${systemSettings.system}.default = inputs.devenv.lib.mkShell { + inherit inputs pkgs; + modules = [ + ({ pkgs, config, ... }: { + # This is your devenv configuration - # https://devenv.sh/reference/options/#pre-commithooks - git-hooks.hooks = { - end-of-file-fixer.enable = true; - trim-trailing-whitespace.enable = true; - }; + # https://devenv.sh/reference/options/#pre-commithooks + git-hooks.hooks = { + end-of-file-fixer.enable = true; + trim-trailing-whitespace.enable = true; + }; - # https://devenv.sh/supported-languages/python/ - languages.python = { + # https://devenv.sh/supported-languages/python/ + languages.python = { + enable = true; + # version = systemSettings.pythonVersion; + uv = { enable = true; - # version = systemSettings.pythonVersion; - uv = { + package = pkgs.uv; + sync = { enable = true; - package = pkgs.uv; - sync = { - enable = true; - allExtras = true; - arguments = [ "-U" ]; - }; + allExtras = true; + arguments = [ "-U" ]; }; }; + }; - packages = with pkgs; [ - git + packages = with pkgs; [ + git + gdbm + # (python312.withPackages (python-pkgs: with python-pkgs; [ gdbm ])) + (python312.withPackages (python-pkgs: with python-pkgs; [ gdbm - # (python312.withPackages (python-pkgs: with python-pkgs; [ gdbm ])) - (python312.withPackages (python-pkgs: with python-pkgs; [ - gdbm - notebook # kinda hacky, but needed so that jupyter notebook has some shared library it needs? - ])) - (writeShellScriptBin "docs" "${pkgs.uv}/bin/uv run sphinx-autobuild -E ./docs/ ./docs_build --port 9999") - (writeShellScriptBin "ab" "${pkgs.uv}/bin/uv build --wheel --refresh") - (writeShellScriptBin "adb" "ab && ${pkgs.docker}/bin/docker build -t acockburn/appdaemon:local-dev .") - # (writeShellScriptBin "ad-nb" "cd $(readlink -f /etc/nixos) && devenv up") - ]; + notebook # kinda hacky, but needed so that jupyter notebook has some shared library it needs? + ])) + (writeShellScriptBin "docs" "${pkgs.uv}/bin/uv run sphinx-autobuild -E ./docs/ ./docs_build --port 9999") + (writeShellScriptBin "ab" "${pkgs.uv}/bin/uv build --wheel --refresh") + (writeShellScriptBin "adb" "ab && ${pkgs.docker}/bin/docker build -t acockburn/appdaemon:local-dev .") + # (writeShellScriptBin "ad-nb" "cd $(readlink -f /etc/nixos) && devenv up") + ]; - # processes = { - # my-jup.exec = "uv run jupyter notebook"; - # }; + # processes = { + # my-jup.exec = "uv run jupyter notebook"; + # }; - enterShell = '' - alias fix="${pkgs.uv}/bin/uv run ruff check --fix" - alias appdaemon="${pkgs.uv}/bin/uv run --frozen appdaemon" - # alias ad="appdaemon" + enterShell = '' + alias fix="${pkgs.uv}/bin/uv run ruff check --fix" + alias appdaemon="${pkgs.uv}/bin/uv run --frozen appdaemon" + # alias ad="appdaemon" - export PS1="\[\e[0;34m\](AppDaemon)\[\e[0m\] \[\033[1;32m\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\$\[\033[0m\] " + export PS1="\[\e[0;34m\](AppDaemon)\[\e[0m\] \[\033[1;32m\][\[\e]0;\u@\h: \w\a\]\u@\h:\w]\$\[\033[0m\] " - export VIRTUAL_ENV=$UV_PROJECT_ENVIRONMENT + export VIRTUAL_ENV=$UV_PROJECT_ENVIRONMENT - echo -e "URL: \e[34m$(${pkgs.git}/bin/git config --get remote.origin.url)\e[0m" - echo -e "Branch/Tag: \e[32m$(${pkgs.git}/bin/git describe --tags --exact-match 2>/dev/null || ${pkgs.git}/bin/git rev-parse --abbrev-ref HEAD)\e[0m" - echo -e "Hash: \e[33m$(${pkgs.git}/bin/git rev-parse --short HEAD)\e[0m" - echo "AppDaemon v$(${pkgs.uv}/bin/uv pip show appdaemon | awk '/^Version:/ {print $2}') development shell started" - ''; - }) - ]; - }; + echo -e "URL: \e[34m$(${pkgs.git}/bin/git config --get remote.origin.url)\e[0m" + echo -e "Branch/Tag: \e[32m$(${pkgs.git}/bin/git describe --tags --exact-match 2>/dev/null || ${pkgs.git}/bin/git rev-parse --abbrev-ref HEAD)\e[0m" + echo -e "Hash: \e[33m$(${pkgs.git}/bin/git rev-parse --short HEAD)\e[0m" + echo "AppDaemon v$(${pkgs.uv}/bin/uv pip show appdaemon | awk '/^Version:/ {print $2}') development shell started" + ''; + }) + ]; + }; }; } \ No newline at end of file diff --git a/home-manager/default.nix b/home-manager/default.nix index 8e1f07b..564e2c6 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -9,28 +9,16 @@ users.users.${userSettings.userName} = { isNormalUser = true; extraGroups = [ "wheel" "docker" ]; - openssh.authorizedKeys.keyFiles = [ ../secrets/authorized_keys ]; - shell = "${pkgs.zsh}/bin/zsh"; }; home-manager = { useGlobalPkgs = true; - users.${userSettings.userName} = { ... }: { + users.${userSettings.userName} = { home.stateVersion = systemSettings.stateVersion; home.homeDirectory = lib.mkForce "${userSettings.adHome}"; systemd.user.startServices = "sd-switch"; # helps with handling systemd services when switching - imports = [ - (import ./zsh.nix) - (import ./git.nix {inherit userSettings;}) - ]; - home.packages = with pkgs; [ - # Add any additional packages you want to install in your home directory - superfile - ]; - programs = { - ssh.enable = true; - gh.enable = true; - }; + programs.ssh.enable = true; + programs.gh.enable = true; }; }; } diff --git a/scripts/default.nix b/scripts/default.nix index c9fd2d9..f24cc68 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -1,17 +1,9 @@ { pkgs, systemSettings, ... }: { environment.systemPackages = with pkgs; [ - (pkgs.writeShellScriptBin "nfs" '' - sudo nixos-rebuild switch --flake $(readlink -f /etc/nixos)#${systemSettings.hostName} --impure - '') - (pkgs.writeShellScriptBin "nfsu" '' - FLAKE=$(readlink -f /etc/nixos) - nix flake update --flake $FLAKE --impure - git -C $FLAKE add "$FLAKE/flake.lock" > /dev/null 2>&1 - sudo nixos-rebuild switch --flake $FLAKE#${systemSettings.hostName} --impure - '') (pkgs.writeShellScriptBin "ads" "nix develop --no-pure-eval $(readlink -f /etc/nixos)") (pkgs.writeShellScriptBin "link-nix" "${builtins.readFile ./link-nix.sh}") (pkgs.writeShellScriptBin "sops-ad" "sops $(readlink -f /etc/nixos)/secrets/encrypted_secrets.yaml") + (pkgs.writeShellScriptBin "lola-up" "docker compose -f /conf/lola/docker-compose.yml up -d") ]; } \ No newline at end of file