fix(system): properly configure jupyter #110

Merged
jalil merged 1 commit from fix-jupyter into main 2024-10-16 18:54:53 +02:00
3 changed files with 149 additions and 124 deletions

View file

@ -1,14 +1,13 @@
{ inputs, lib, ... }: { inputs, lib, ... }:
{
# Example vm configuration
flake.nixosConfigurations.vm =
let let
system = "x86_64-linux"; system = "x86_64-linux";
overlays = builtins.attrValues inputs.self.overlays; overlays = builtins.attrValues inputs.self.overlays;
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "steam-original" ]; config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "steam-original" ];
pkgs = import inputs.nixpkgs { inherit system overlays config; }; pkgs = import inputs.nixpkgs { inherit system overlays config; };
in in
lib.nixosSystem { {
# Example vm configuration
flake.nixosConfigurations.vm = lib.nixosSystem {
inherit system pkgs; inherit system pkgs;
modules = [ modules = [
inputs.self.nixosModules.vm # import vm module inputs.self.nixosModules.vm # import vm module
@ -32,15 +31,25 @@
jhome = { jhome = {
enable = true; enable = true;
gui.enable = true; gui.enable = true;
dev.rust.enable = true; dev = {
enable = true;
rust.enable = true;
};
}; };
}; };
nix.registry.nixpkgs.flake = inputs.nixpkgs; nix.registry.nixpkgs.flake = inputs.nixpkgs;
# password is 'test' see module documentation for more options
services.jupyter.password = "'sha1:1b961dc713fb:88483270a63e57d18d43cf337e629539de1436ba'";
jconfig = { jconfig = {
enable = true; enable = true;
dev = {
enable = true;
jupyter.enable = true;
};
gui.enable = true; gui.enable = true;
}; };
} }
]; ];
}; };
} }

View file

@ -26,8 +26,12 @@ in
{ stylix = import ./stylix-config.nix { inherit config pkgs; }; } { stylix = import ./stylix-config.nix { inherit config pkgs; }; }
]; ];
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable (
boot.plymouth.enable = cfg.styling.enable; lib.mkMerge [
{
boot.plymouth = {
inherit (cfg.styling) enable;
};
# Enable unlocking the gpg-agent at boot (configured through home.nix) # Enable unlocking the gpg-agent at boot (configured through home.nix)
security.pam.services.login.gnupg.enable = true; security.pam.services.login.gnupg.enable = true;
@ -47,12 +51,14 @@ in
]; ];
# Enable dev documentation # Enable dev documentation
documentation.dev.enable = cfg.dev.enable; documentation.dev = {
inherit (cfg.dev) enable;
};
programs = { programs = {
# Shell prompt # Shell prompt
starship = { starship = {
enable = true; enable = true;
settings = lib.mkIf cfg.styling.enable { settings = {
format = "$time$all"; format = "$time$all";
add_newline = false; add_newline = false;
cmd_duration.min_time = 500; cmd_duration.min_time = 500;
@ -84,10 +90,6 @@ in
openssh.authorizedKeysFiles = builtins.map (path: "/etc/${path}") ( openssh.authorizedKeysFiles = builtins.map (path: "/etc/${path}") (
builtins.attrNames keysFromGithub builtins.attrNames keysFromGithub
); );
jupyter = {
inherit (cfg.dev) enable;
group = "users";
};
}; };
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
# Open ports for spotifyd # Open ports for spotifyd
@ -113,5 +115,16 @@ in
]; ];
}; };
}; };
}; }
# dev configuration
(lib.mkIf cfg.dev.enable {
users.extraUsers = lib.mkIf cfg.dev.jupyter.enable { jupyter.group = "jupyter"; };
services.jupyter = {
inherit (cfg.dev.jupyter) enable;
group = "jupyter";
user = "jupyter";
};
})
]
);
} }

View file

@ -60,7 +60,10 @@ let
dev = lib.mkOption { dev = lib.mkOption {
description = "Options for setting up a dev environment"; description = "Options for setting up a dev environment";
default = { }; default = { };
type = types.submodule { options.enable = lib.mkEnableOption "dev configuration"; }; type = types.submodule {
options.enable = lib.mkEnableOption "dev configuration";
options.jupyter.enable = lib.mkEnableOption "jupyter configuration";
};
}; };
gui = lib.mkOption { gui = lib.mkOption {
description = "Jalil's default configuration for a NixOS gui."; description = "Jalil's default configuration for a NixOS gui.";