roles with home-manager

This commit is contained in:
Giulio De Pasquale 2021-10-14 12:53:44 +01:00
parent 75a63c6329
commit 163cc286af
6 changed files with 73 additions and 85 deletions

View File

@ -28,8 +28,8 @@
inherit (utils) user; inherit (utils) user;
in { in {
nixosConfigurations = { nixosConfigurations = {
architect = host.mkHost { name = "architect"; users = [ "giulio" ]; }; architect = host.mkHost { name = "architect"; users = [ { user = "giulio"; } ]; };
gAluminum = host.mkHost { name = "gAluminum"; users = [ "giulio" ]; roles = [ "gnome" ]; }; gAluminum = host.mkHost { name = "gAluminum"; users = [ { user = "giulio"; roles = [ "desktop" "ssh" ]; } ]; roles = [ "gnome" ]; };
proxy = host.mkHost { name = "proxy"; }; proxy = host.mkHost { name = "proxy"; };
}; };
}; };

View File

@ -7,7 +7,7 @@
mkRole = role : import (../roles + "/${role}.nix"); mkRole = role : import (../roles + "/${role}.nix");
users_mod= (map (u: user.mkUser u) users); users_mod= (map (u: user.mkUser {name = u.user; roles= u.roles; }) users);
roles_mod = (map (r: mkRole r) roles); roles_mod = (map (r: mkRole r) roles);
in nixpkgs.lib.nixosSystem { in nixpkgs.lib.nixosSystem {
inherit system; inherit system;
@ -23,6 +23,12 @@
]; ];
nix.registry.nixpkgs.flake = nixpkgs; nix.registry.nixpkgs.flake = nixpkgs;
nix.registry.unstable.flake = nixos-unstable; nix.registry.unstable.flake = nixos-unstable;
users.users.root = {
shell = pkgs.zsh;
};
home-manager.users.root.imports = [ ../roles/home/common.nix ];
} }
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager

View File

@ -1,7 +1,11 @@
{ pkgs, ...}: { pkgs, ...}:
{ {
mkUser = name: { mkUser = { name, roles ? [] }:
let
mkRole = role: import (../roles/home + "/${role}.nix");
roles_mod = (map (r: mkRole r) roles);
in {
fileSystems."/home/${name}/Downloads" = { fileSystems."/home/${name}/Downloads" = {
device = "tmpfs"; device = "tmpfs";
fsType = "tmpfs"; fsType = "tmpfs";
@ -14,6 +18,6 @@
extraGroups = [ "wheel" ]; extraGroups = [ "wheel" ];
}; };
home-manager.users.${name}.imports = [ ../roles/home ]; home-manager.users.${name}.imports = [ ../roles/home/common.nix ] ++ roles_mod;
}; };
} }

View File

@ -1,13 +1,21 @@
{ config, pkgs, lib, home, ... }: { config, pkgs, ... }:
{ {
nixpkgs.config.allowUnfree = true; imports = [ ./zsh.nix ];
home.packages = with pkgs; [ home = {
nixfmt stateVersion = "21.05";
vscode sessionVariables = {
jetbrains.idea-ultimate EDITOR = "nvim";
]; VISUAL = "nvim";
};
packages = with pkgs; [
rizin
sshfs
nixfmt
];
};
programs.neovim = { programs.neovim = {
enable = true; enable = true;
@ -69,8 +77,6 @@
set cindent cinkeys-=0# set cindent cinkeys-=0#
set expandtab shiftwidth=2 tabstop=2 softtabstop=2 set expandtab shiftwidth=2 tabstop=2 softtabstop=2
set statusline+=%#warningmsg# set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%* set statusline+=%*
@ -95,5 +101,4 @@
vimtex vimtex
]; ];
}; };
} }

View File

@ -1,69 +0,0 @@
{ config, pkgs, ... }:
let
albert_autostart = (pkgs.makeAutostartItem {
name = "albert";
package = pkgs.albert;
});
guake_autostart = (pkgs.makeAutostartItem {
name = "guake";
package = pkgs.guake;
});
in
{
imports = [
./zsh.nix
./code.nix
./git.nix
./gnome.nix
./ssh.nix
];
home = {
stateVersion = "21.05";
sessionVariables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
packages = with pkgs; [
albert
guake
firefox
brave
chromium
rizin
nmap
slack
signal-desktop
teams
discord
element-desktop
spotify
bind
gparted
sshfs
libreoffice
albert_autostart
guake_autostart
];
};
programs = {
direnv = {
enable = true;
nix-direnv.enable = true;
nix-direnv.enableFlakes = true;
};
};
}

42
roles/home/desktop.nix Normal file
View File

@ -0,0 +1,42 @@
{ pkgs, ... }:
let
albert_autostart = (pkgs.makeAutostartItem {
name = "albert";
package = pkgs.albert;
});
guake_autostart = (pkgs.makeAutostartItem {
name = "guake";
package = pkgs.guake;
});
in
{
imports = [ ./gnome.nix ];
nixpkgs.config.allowUnfree = true;
home.packages = with pkgs; [
albert
guake
firefox
brave
chromium
slack
signal-desktop
teams
discord
element-desktop
spotify
gparted
libreoffice
vscode
jetbrains.idea-ultimate
albert_autostart
guake_autostart
];
}