making a mess of it, but getting to auto loading multi user setups!
This commit is contained in:
parent
20a2450683
commit
b139021f8e
13 changed files with 139 additions and 216 deletions
12
default.nix
12
default.nix
|
@ -1,9 +1,8 @@
|
|||
{ inputs, config, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (builtins) toString;
|
||||
inherit (lib.attrsets) attrValues filterAttrs mapAttrs mapAttrsToList;
|
||||
inherit (lib.modules) mkAliasOptionModule mkDefault mkIf;
|
||||
inherit (lib.my) mapModulesRec';
|
||||
inherit (lib.modules) mkAliasOptionModule mkIf;
|
||||
inherit (lib.my) mapModulesRec' mapModules mkSysUser mkHmUser;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
|
@ -14,8 +13,6 @@ in
|
|||
inputs.sops-nix.nixosModules.sops
|
||||
(mkAliasOptionModule ["hm"] ["home-manager" "users" config.user.name])
|
||||
(mkAliasOptionModule ["home"] ["hm" "home"])
|
||||
(mkAliasOptionModule ["create" "configFile"] ["hm" "xdg" "configFile"])
|
||||
(mkAliasOptionModule ["create" "dataFile"] ["hm" "xdg" "dataFile"])
|
||||
]
|
||||
++ (mapModulesRec' (toString ./modules) import);
|
||||
|
||||
|
@ -37,9 +34,4 @@ in
|
|||
|
||||
age.keyFile = "/home/";
|
||||
};
|
||||
|
||||
system = {
|
||||
stateVersion = "23.11";
|
||||
configurationRevision = with inputs; mkIf (self ? rev) self.rev;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -91,7 +91,5 @@
|
|||
// mapModulesRec ./modules import;
|
||||
|
||||
nixosConfigurations = mapHosts ./hosts {};
|
||||
|
||||
devShells."${system}".default = import ./shell.nix { inherit lib pkgs; };
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
imports = [ ./hardware.nix ];
|
||||
|
||||
user.name = "chris";
|
||||
|
||||
fileSystems."/home/chris/games" = {
|
||||
|
|
5
hosts/chris-pc/users/Kaas/default.nix
Normal file
5
hosts/chris-pc/users/Kaas/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{}:
|
||||
{
|
||||
full_name = "WOOOP WOOOP";
|
||||
is_trusted = true;
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
// { config, lib, pkgs, ... }:
|
||||
// {
|
||||
// full_name = "WOOT";
|
||||
|
||||
// modules = {
|
||||
// themes = {
|
||||
// enable = true;
|
||||
// theme = "everforest";
|
||||
// polarity = "dark";
|
||||
// };
|
||||
|
||||
// develop = {
|
||||
// rust.enable = true;
|
||||
// js.enable = true;
|
||||
// dotnet.enable = true;
|
||||
// };
|
||||
|
||||
// # EXPERIMENTS
|
||||
// # services.games.minecraft.enable = true;
|
||||
// services.auth.enable = true;
|
||||
|
||||
// desktop = {
|
||||
// plasma.enable = true;
|
||||
// type = "wayland";
|
||||
|
||||
// applications = {
|
||||
// communication.enable = true;
|
||||
// email.enable = true;
|
||||
// office.enable = true;
|
||||
// steam.enable = true;
|
||||
// recording.enable = true;
|
||||
// };
|
||||
|
||||
// terminal = {
|
||||
// default = "ghostty";
|
||||
// alacritty.enable = true;
|
||||
// ghostty.enable = true;
|
||||
// };
|
||||
|
||||
// editors = {
|
||||
// default = "zed";
|
||||
// vscodium.enable = true;
|
||||
// zed.enable = true;
|
||||
// nvim.enable = true;
|
||||
// nano.enable = true;
|
||||
// kate.enable = true;
|
||||
// };
|
||||
|
||||
// browsers = {
|
||||
// default = "chromium";
|
||||
// firefox.enable = true;
|
||||
// chrome.enable = true;
|
||||
// };
|
||||
|
||||
// games = {
|
||||
// minecraft.enable = true;
|
||||
// };
|
||||
// };
|
||||
|
||||
// shell = {
|
||||
// default = "zsh";
|
||||
// corePkgs.enable = true;
|
||||
// };
|
||||
// };
|
||||
// }
|
|
@ -1,24 +1,53 @@
|
|||
{ inputs, lib, pkgs, self, ... }:
|
||||
let
|
||||
{
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs.nixpkgs.lib) nixosSystem;
|
||||
inherit (builtins) baseNameOf elem;
|
||||
inherit (lib.attrsets) filterAttrs;
|
||||
inherit (lib.modules) mkDefault;
|
||||
inherit (lib.strings) removeSuffix;
|
||||
inherit (self.modules) mapModules;
|
||||
inherit (self) mkSysUser mkHmUser;
|
||||
in rec
|
||||
{
|
||||
mkHost = path: attrs @ {system ? "x86_64-linux", ...}:
|
||||
nixosSystem {
|
||||
inherit system;
|
||||
|
||||
specialArgs = { inherit lib inputs system; };
|
||||
specialArgs = {inherit lib inputs system;};
|
||||
|
||||
modules = [
|
||||
modules =
|
||||
let
|
||||
stateVersion = "23.11";
|
||||
in [
|
||||
inputs.nixos-boot.nixosModules.default
|
||||
{
|
||||
nixpkgs.pkgs = pkgs;
|
||||
networking.hostName = mkDefault (removeSuffix ".nix" (baseNameOf path));
|
||||
|
||||
system = {
|
||||
inherit stateVersion;
|
||||
configurationRevision = with inputs; mkIf (self ? rev) self.rev;
|
||||
};
|
||||
|
||||
imports = [ "${path}/hardware.nix" ];
|
||||
|
||||
users = {
|
||||
mutableUsers = false;
|
||||
users = mapModules "${path}/users" mkSysUser;
|
||||
};
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
sharedModules = [
|
||||
inputs.plasma-manager.homeManagerModules.plasma-manager
|
||||
];
|
||||
users = mapModules "${path}/users" (p: mkHmUser p stateVersion);
|
||||
};
|
||||
}
|
||||
(filterAttrs (n: v: !elem n ["system"]) attrs)
|
||||
../. # ../default.nix
|
||||
|
@ -26,6 +55,6 @@ in rec
|
|||
];
|
||||
};
|
||||
|
||||
mapHosts = dir: attrs @ { system ? system, ... }:
|
||||
mapHosts = dir: attrs @ {system ? system, ...}:
|
||||
mapModules dir (hostPath: mkHost hostPath attrs);
|
||||
}
|
||||
|
|
31
lib/user.nix
Normal file
31
lib/user.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ lib, ... }: let
|
||||
inherit (builtins) baseNameOf;
|
||||
inherit (lib.attrsets) filterAttrs;
|
||||
inherit (lib.strings) removeSuffix;
|
||||
in rec
|
||||
{
|
||||
mkSysUser = path: let
|
||||
user = import path {};
|
||||
name = removeSuffix ".nix" (baseNameOf path);
|
||||
in
|
||||
{
|
||||
inherit name;
|
||||
inherit (user) is_trusted;
|
||||
description = user.full_name;
|
||||
extraGroups = (if user.is_trusted then [ "wheel" ] else []);
|
||||
isNormalUser = true;
|
||||
home = "/home/${name}";
|
||||
group = "users";
|
||||
};
|
||||
|
||||
mkHmUser = path: stateVersion: let
|
||||
user = import path {};
|
||||
name = removeSuffix ".nix" (baseNameOf path);
|
||||
in
|
||||
{
|
||||
home = {
|
||||
inherit stateVersion;
|
||||
sessionPath = [ "$SNEEUWVLOK_BIN" "$XDG_BIN_HOME" "$PATH" ]; # Pretty sure I don't need this.
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,19 +1,67 @@
|
|||
{ config, options, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (lib.meta) getExe;
|
||||
{
|
||||
config,
|
||||
options,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.attrsets) attrValues;
|
||||
|
||||
cfg = config.modules.desktop.editors.zed;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.modules.desktop.editors.zed = let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
in { enable = mkEnableOption "zed"; };
|
||||
in {enable = mkEnableOption "zed";};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
user.packages = attrValues {
|
||||
inherit (pkgs) zed-editor;
|
||||
};
|
||||
|
||||
hm.programs.zed-editor = {
|
||||
enable = true;
|
||||
|
||||
extraPackages = with pkgs; [ nixd nil alejandra ];
|
||||
extensions = ["nix" "toml" "html"];
|
||||
|
||||
userSettings = {
|
||||
assistant.enabled = false;
|
||||
|
||||
vim_mode = false;
|
||||
load_direnv = "shell_hook";
|
||||
base_keymap = "JetBrains";
|
||||
|
||||
tabs = {
|
||||
file_icons = true;
|
||||
git_status = true;
|
||||
};
|
||||
project_panel.auto_reveal_entries = false;
|
||||
|
||||
hour_format = "hour24";
|
||||
auto_update = false;
|
||||
|
||||
lsp = {
|
||||
nixd = {};
|
||||
nil = {
|
||||
initialization_options = {
|
||||
formatting = {
|
||||
command = ["alejandra" "--quiet" "--"];
|
||||
};
|
||||
};
|
||||
binary = {
|
||||
path_lookup = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
languages = {
|
||||
"Nix" = {
|
||||
language_servers = ["nixd" "nil"];
|
||||
format_on_save = "on";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -45,55 +45,7 @@ in {
|
|||
args = ["-l" "-c" "tmux new || tmux"];
|
||||
};
|
||||
}
|
||||
|
||||
# (mkIf (active != null) {
|
||||
# import = ["~/.config/alacritty/config/${active}.toml"];
|
||||
# })
|
||||
];
|
||||
};
|
||||
|
||||
# create.configFile = mkIf (active != null) {
|
||||
# alacritty-conf = {
|
||||
# target = "alacritty/config/${active}.toml";
|
||||
# source = let
|
||||
# inherit (config.modules.themes.font) mono sans;
|
||||
# tomlFormat = pkgs.formats.toml {};
|
||||
# in tomlFormat.generate "alacritty-theme" {
|
||||
# font = {
|
||||
# builtin_box_drawing = true;
|
||||
# size = mono.size;
|
||||
#
|
||||
# normal = {
|
||||
# family = "${mono.family}";
|
||||
# style = "${sans.weight}";
|
||||
# };
|
||||
#
|
||||
# italic = {
|
||||
# family = "${mono.family}";
|
||||
# style = "${sans.weight} Italic";
|
||||
# };
|
||||
#
|
||||
# bold = {
|
||||
# family = "${mono.family}";
|
||||
# style = "${mono.weight}";
|
||||
# };
|
||||
#
|
||||
# bold_italic = {
|
||||
# family = "${mono.family}";
|
||||
# style = "${mono.weight} Italic";
|
||||
# };
|
||||
#
|
||||
# offset = {
|
||||
# x = 0;
|
||||
# y = 0;
|
||||
# };
|
||||
# glyph_offset = {
|
||||
# x = 0;
|
||||
# y = 0;
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
# };
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ let
|
|||
in
|
||||
{
|
||||
options = let
|
||||
inherit (lib.types) attrs path str;
|
||||
inherit (lib.types) attrs path;
|
||||
inherit (lib.my) mkOpt;
|
||||
in
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ in
|
|||
|
||||
sneeuwvlok = {
|
||||
dir = mkOpt path (findFirst pathExists (toString ../.) [
|
||||
"${config.user.home}/Github/.files"
|
||||
"${config.user.home}/Github/sneeuwvlok"
|
||||
]);
|
||||
hostDir = mkOpt path "${config.sneeuwvlok.dir}/hosts/${config.networking.hostName}";
|
||||
configDir = mkOpt path "${config.sneeuwvlok.dir}/config";
|
||||
|
@ -24,10 +24,6 @@ in
|
|||
};
|
||||
|
||||
config = {
|
||||
environment.systemPackages = [
|
||||
pkgs.sops
|
||||
];
|
||||
|
||||
user = {
|
||||
name = "chris";
|
||||
description = "Chris Kruining";
|
||||
|
@ -38,27 +34,16 @@ in
|
|||
uid = 1000;
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
sharedModules = [
|
||||
inputs.plasma-manager.homeManagerModules.plasma-manager
|
||||
];
|
||||
};
|
||||
users.users.${config.user.name} = mkAliasDefinitions options.user;
|
||||
|
||||
home = {
|
||||
stateVersion = config.system.stateVersion;
|
||||
sessionPath = [ "$SNEEUWVLOK_BIN" "$XDG_BIN_HOME" "$PATH" ];
|
||||
};
|
||||
nix.settings = let
|
||||
inherit (lib) attrNames filterAttrs;
|
||||
|
||||
users.users = {
|
||||
${config.user.name} = mkAliasDefinitions options.user;
|
||||
};
|
||||
|
||||
nix.settings = let users = [ "root" config.user.name ]; in
|
||||
{
|
||||
trusted-users = users;
|
||||
allowed-users = users;
|
||||
};
|
||||
users = (attrNames (filterAttrs ({ is_trusted ? false }: is_trusted) config.users)) ++ [ "root" ];
|
||||
in
|
||||
{
|
||||
trusted-users = users;
|
||||
allowed-users = users;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -89,56 +89,5 @@ in
|
|||
log_level = "DEBUG";
|
||||
};
|
||||
};
|
||||
|
||||
# create.configFile.btop-theme = let
|
||||
# inherit (config.modules.themes) active;
|
||||
# in
|
||||
# mkIf (active != null) {
|
||||
# target = "btop/themes/${active}.theme";
|
||||
# text = ''
|
||||
# theme[main_bg]="bg"
|
||||
# theme[main_fg]="fg"
|
||||
# theme[title]="fg"
|
||||
# theme[hi_fg]="highlight"
|
||||
# theme[selected_bg]="border"
|
||||
# theme[selected_fg]="bg"
|
||||
# theme[inactive_fg]="brightBlack"
|
||||
# theme[graph_text]="brightYellow"
|
||||
# theme[meter_bg]="brightblack"
|
||||
# theme[proc_misc]="brightYellow"
|
||||
# theme[cpu_box]="brightCyan"
|
||||
# theme[mem_box]="brightGreen"
|
||||
# theme[net_box]="brightMagenta"
|
||||
# theme[proc_box]="brightYellow"
|
||||
# theme[div_line]="brightblack"
|
||||
# theme[temp_start]="brightYellow"
|
||||
# theme[temp_mid]="panelbg"
|
||||
# theme[temp_end]="brightRed"
|
||||
# theme[cpu_start]="brightCyan"
|
||||
# theme[cpu_mid]="border"
|
||||
# theme[cpu_end]="brightGreen"
|
||||
# theme[free_start]="brightGreen"
|
||||
# theme[free_mid]="brightGreen"
|
||||
# theme[free_end]="brightGreen"
|
||||
# theme[cached_start]="brightYellow"
|
||||
# theme[cached_mid]="brightYellow"
|
||||
# theme[cached_end]="brightMagenta"
|
||||
# theme[available_start]="brightYellow"
|
||||
# theme[available_mid]="brightYellow"
|
||||
# theme[available_end]="brightYellow"
|
||||
# theme[used_start]="panelbg"
|
||||
# theme[used_mid]="panelbg"
|
||||
# theme[used_end]="brightRed"
|
||||
# theme[download_start]="brightBlue"
|
||||
# theme[download_mid]="brightBlue"
|
||||
# theme[download_end]="brightMagenta"
|
||||
# theme[upload_start]="brightBlue"
|
||||
# theme[upload_mid]="brightBlue"
|
||||
# theme[upload_end]="brightMagenta"
|
||||
# theme[process_start]="brightCyan"
|
||||
# theme[process_mid]="border"
|
||||
# theme[process_end]="brightGreen"
|
||||
# '';
|
||||
# };
|
||||
};
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ in
|
|||
# };
|
||||
};
|
||||
|
||||
create.configFile.zsh-abbreviations = {
|
||||
hm.xdg.configFile."zsh-abbreviations" = {
|
||||
target = "zsh/abbreviations";
|
||||
text = let
|
||||
abbrevs = import "${config.sneeuwvlok.configDir}/shell-abbr";
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
environment.systemPackages = with pkgs; [
|
||||
kdePackages.kwallet-pam
|
||||
bitwarden
|
||||
sops
|
||||
];
|
||||
|
||||
security = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue