diff --git a/flake.lock b/flake.lock index c510818..97c7ea8 100644 --- a/flake.lock +++ b/flake.lock @@ -16,6 +16,43 @@ "type": "github" } }, + "base16-schemes_2": { + "flake": false, + "locked": { + "lastModified": 1696158499, + "narHash": "sha256-5yIHgDTPjoX/3oDEfLSQ0eJZdFL1SaCfb9d6M0RmOTM=", + "owner": "tinted-theming", + "repo": "base16-schemes", + "rev": "a9112eaae86d9dd8ee6bb9445b664fba2f94037a", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-schemes", + "type": "github" + } + }, + "blog-generator": { + "inputs": { + "flake-utils": "flake-utils", + "nix-colors": "nix-colors", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1760112475, + "narHash": "sha256-hnCdPTzAD92XQBW7eBzERUvf8wNRTCG5ih5iBpUlK8k=", + "owner": "adrlau", + "repo": "blog-generator", + "rev": "f447902d19ecc8f66806c399db758dcd132bf84a", + "type": "github" + }, + "original": { + "owner": "adrlau", + "repo": "blog-generator", + "type": "github" + } + }, "crane": { "locked": { "lastModified": 1731098351, @@ -68,6 +105,24 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -120,7 +175,7 @@ "nixpkgs" ], "pre-commit-hooks-nix": "pre-commit-hooks-nix", - "rust-overlay": "rust-overlay" + "rust-overlay": "rust-overlay_2" }, "locked": { "lastModified": 1737639419, @@ -156,6 +211,25 @@ "type": "github" } }, + "nix-colors_2": { + "inputs": { + "base16-schemes": "base16-schemes_2", + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1707825078, + "narHash": "sha256-hTfge2J2W+42SZ7VHXkf4kjU+qzFqPeC9k66jAUBMHk=", + "owner": "misterio77", + "repo": "nix-colors", + "rev": "b01f024090d2c4fc3152cd0cf12027a7b8453ba1", + "type": "github" + }, + "original": { + "owner": "misterio77", + "repo": "nix-colors", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1759261527, @@ -174,16 +248,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1759281824, - "narHash": "sha256-FIBE1qXv9TKvSNwst6FumyHwCRH3BlWDpfsnqRDCll0=", + "lastModified": 1759831965, + "narHash": "sha256-vgPm2xjOmKdZ0xKA6yLXPJpjOtQPHfaZDRtH+47XEBo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5b5be50345d4113d04ba58c444348849f5585b4a", + "rev": "c9b6fb798541223bbb396d287d16f43520250518", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-25.05", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -203,6 +277,21 @@ "type": "github" } }, + "nixpkgs-lib_2": { + "locked": { + "lastModified": 1697935651, + "narHash": "sha256-qOfWjQ2JQSQL15KLh6D7xQhx0qgZlYZTYlcEiRuAMMw=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "e1e11fdbb01113d85c7f41cada9d2847660e3902", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1730741070, @@ -219,6 +308,38 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1744536153, + "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1759281824, + "narHash": "sha256-FIBE1qXv9TKvSNwst6FumyHwCRH3BlWDpfsnqRDCll0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5b5be50345d4113d04ba58c444348849f5585b4a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, "pre-commit-hooks-nix": { "inputs": { "flake-compat": [ @@ -248,16 +369,35 @@ }, "root": { "inputs": { + "blog-generator": "blog-generator", "home-manager": "home-manager", "lanzaboote": "lanzaboote", - "nix-colors": "nix-colors", + "nix-colors": "nix-colors_2", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_3", "sops-nix": "sops-nix", "unstable": "unstable" } }, "rust-overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1760063676, + "narHash": "sha256-s5Fjh43skH2L+avOGioLmEHoYZffDbg3abV5h0gjeew=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "897deed0923cc5a1d560c5176abe0d172ec9716d", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_2": { "inputs": { "nixpkgs": [ "lanzaboote", @@ -298,6 +438,21 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "unstable": { "locked": { "lastModified": 1759036355, diff --git a/flake.nix b/flake.nix index 0b83b5d..b8c075f 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,9 @@ nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + + blog-generator.url = "github:adrlau/blog-generator"; + }; outputs = @@ -36,6 +39,7 @@ sops-nix, lanzaboote, nixos-hardware, + blog-generator, ... }@inputs: let @@ -65,6 +69,10 @@ nixos-hardware.nixosModules.dell-xps-13-9370 + + #temporarily for testing run my blog on my laptop + blog-generator.nixosModules.default + ]; }; diff --git a/home/niri.nix b/home/niri.nix index b34d3ff..da473f5 100644 --- a/home/niri.nix +++ b/home/niri.nix @@ -235,7 +235,7 @@ let spawn-at-startup "mako" spawn-at-startup "swww-daemon" spawn-at-startup "sh" "-c" "while true; do waybar; done" //disabled to a systemd service. in a while because it sometimes crashes. - spawn-at-startup "sh" "-c" "while true; do swww img --transition-step 2 \"$(find ~/Pictures/wallpapers/ -type l,f | shuf -n 1)\"; sleep 270; done" + spawn-at-startup "sh" "-c" "while true; do swww img -f Nearest --transition-step 2 \"$(find ~/Pictures/wallpapers/ -type l,f | shuf -n 1)\"; sleep 270; done" // Uncomment this line to ask the clients to omit their client-side decorations if possible. diff --git a/hosts/legolas/configuration.nix b/hosts/legolas/configuration.nix index 2fa7dc9..3375269 100644 --- a/hosts/legolas/configuration.nix +++ b/hosts/legolas/configuration.nix @@ -31,6 +31,8 @@ ../../modules/powerprofiles.nix ../../modules/basePackages.nix ../../modules/develPackages.nix + ../../modules/jupyterhub.nix + ../../modules/blog.nix ../../modules/desktopApplications.nix ]; diff --git a/modules/blog.nix b/modules/blog.nix new file mode 100644 index 0000000..296c23b --- /dev/null +++ b/modules/blog.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + services.blog-generator = { + enable = true; + contentDir = "/var/www/blog/content"; + port = 8080; + }; +} diff --git a/modules/develPackages.nix b/modules/develPackages.nix index df2f8f4..9e1af21 100644 --- a/modules/develPackages.nix +++ b/modules/develPackages.nix @@ -57,6 +57,7 @@ python3Packages.requests python3Packages.flake8 python3Packages.torch + python3Packages.pycryptodome #dotnet-sdk_8 #dotnet-sdk_9 diff --git a/modules/jupyterhub.nix b/modules/jupyterhub.nix new file mode 100644 index 0000000..6df0353 --- /dev/null +++ b/modules/jupyterhub.nix @@ -0,0 +1,93 @@ +{ config, pkgs, lib, ... }: +let + myPython = pkgs.python3; + + myJupyterHubEnv = myPython.withPackages (ps: with ps; [ + jupyterhub + jupyterhub-systemdspawner + ipython + jupyterlab + notebook + ipykernel + numpy + scipy + pandas + matplotlib + seaborn + scikit-learn + ]); + + myJupyterLabEnv = myPython.withPackages (ps: with ps; [ + jupyterhub + jupyterlab + ipykernel + numpy + scipy + pandas + matplotlib + seaborn + scikit-learn + ]); + +in +{ + environment.systemPackages = with pkgs; [ + python3Packages.numpy + python3Packages.scipy + python3Packages.pandas + python3Packages.matplotlib + python3Packages.seaborn + python3Packages.scikit-learn + ]; + + users.users.tdt4117 = { + isNormalUser = true; + home = "/home/tdt4117"; + description = "tdt4117 - delete after h25"; + extraGroups = [ ]; + # openssh.authorizedKeys.keys = [ "ssh-dss AAAAB3Nza... " ]; + }; + + services.jupyterhub = { + jupyterhubEnv = myJupyterHubEnv; + jupyterlabEnv = myJupyterLabEnv; + enable = true; + port = 8770; + host = "0.0.0.0"; + extraConfig = '' + c.Authenticator.allow_all = True + c.ConfigurableHTTPProxy.api_url = 'http://0.0.0.0:8770' + c.JupyterHub.bind_url = 'http://0.0.0.0:8771' + ''; + + kernels = { + python3 = let + env = (pkgs.python3.withPackages (pythonPackages: with pythonPackages; [ + ipykernel + pandas + scikit-learn + seaborn + huggingface-hub + datasets + matplotlib + tqdm + numpy + scipy + ])); + in { + displayName = "Python 3 for machine learning"; + argv = [ + "${env.interpreter}" + "-m" + "ipykernel_launcher" + "-f" + "{connection_file}" + ]; + language = "python"; + logo32 = "${env}/${env.sitePackages}/ipykernel/resources/logo-32x32.png"; + logo64 = "${env}/${env.sitePackages}/ipykernel/resources/logo-64x64.png"; + }; + }; + }; +} +