rana machine: emmie personal laptop
This commit is contained in:
6
modules/clan/home-profiles/flake-module.nix
Normal file
6
modules/clan/home-profiles/flake-module.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
clan.modules = {
|
||||
home-user = lib.modules.importApply ./home-user { };
|
||||
};
|
||||
}
|
||||
62
modules/clan/home-profiles/home-user/default.nix
Normal file
62
modules/clan/home-profiles/home-user/default.nix
Normal file
@@ -0,0 +1,62 @@
|
||||
{ ... }:
|
||||
{
|
||||
_class = "clan.service";
|
||||
manifest.name = "common-user-home-manager";
|
||||
manifest.description = "General users' home-manager profile generator";
|
||||
manifest.categories = [ "System" ];
|
||||
|
||||
roles.default = {
|
||||
interface =
|
||||
{ lib, ... }:
|
||||
{
|
||||
options = {
|
||||
username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
kbLayout = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "us";
|
||||
};
|
||||
kbOptions = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "grp:win_space_toggle";
|
||||
};
|
||||
};
|
||||
};
|
||||
perInstance =
|
||||
{ settings, ... }:
|
||||
{
|
||||
nixosModule =
|
||||
{ inputs, ... }:
|
||||
let
|
||||
username = settings.username;
|
||||
in
|
||||
{
|
||||
imports = [ inputs.home-manager.nixosModules.home-manager ];
|
||||
|
||||
users.users.${username} = {
|
||||
initialPassword = "";
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"audio"
|
||||
"video"
|
||||
"networkmanager"
|
||||
];
|
||||
};
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
xkb.layout = settings.kbLayout;
|
||||
xkb.options = settings.kbOptions;
|
||||
};
|
||||
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.${username} = ./home.nix;
|
||||
home-manager.extraSpecialArgs = {
|
||||
inherit inputs username;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
24
modules/clan/home-profiles/home-user/home.nix
Normal file
24
modules/clan/home-profiles/home-user/home.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
osConfig,
|
||||
pkgs,
|
||||
lib,
|
||||
username,
|
||||
...
|
||||
}:
|
||||
{
|
||||
home = {
|
||||
inherit username;
|
||||
homeDirectory = lib.mkForce "/home/${username}";
|
||||
stateVersion = osConfig.system.stateVersion;
|
||||
packages = with pkgs; [
|
||||
libreoffice
|
||||
element-desktop
|
||||
brave
|
||||
firefox
|
||||
keepassxc
|
||||
vlc
|
||||
thunderbird
|
||||
];
|
||||
};
|
||||
programs.home-manager.enable = true;
|
||||
}
|
||||
8
modules/clan/personal-computer/automatic-timezone.nix
Normal file
8
modules/clan/personal-computer/automatic-timezone.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
services.automatic-timezoned.enable = true;
|
||||
services.geoclue2 = {
|
||||
enableDemoAgent = lib.mkForce true;
|
||||
geoProviderUrl = "https://beacondb.net/v1/geolocate";
|
||||
};
|
||||
}
|
||||
19
modules/clan/personal-computer/default.nix
Normal file
19
modules/clan/personal-computer/default.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{ ... }:
|
||||
{
|
||||
_class = "clan.service";
|
||||
manifest.name = "personal-computer";
|
||||
manifest.description = "A service for configuring personal computer such as printing, automatic-timezone, etc.";
|
||||
manifest.categories = [ "System" ];
|
||||
|
||||
roles.default = {
|
||||
perInstance.nixosModule =
|
||||
{ inputs, lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
(inputs.import-tree.initFilter (
|
||||
p: !lib.hasSuffix "default.nix" p && !lib.hasSuffix "flake-module.nix" p
|
||||
) ./.)
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
4
modules/clan/personal-computer/desktop-environment.nix
Normal file
4
modules/clan/personal-computer/desktop-environment.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{ config, ... }:
|
||||
{
|
||||
security.pam.services."sddm".kwallet.enable = config.services.desktopManager.plasma6.enable;
|
||||
}
|
||||
6
modules/clan/personal-computer/flake-module.nix
Normal file
6
modules/clan/personal-computer/flake-module.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
clan.modules = {
|
||||
personal-computer = lib.modules.importApply ./default.nix { };
|
||||
};
|
||||
}
|
||||
11
modules/clan/personal-computer/libinput.nix
Normal file
11
modules/clan/personal-computer/libinput.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
services = {
|
||||
libinput = {
|
||||
enable = true;
|
||||
touchpad = {
|
||||
disableWhileTyping = true;
|
||||
naturalScrolling = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
62
modules/clan/personal-computer/printing.nix
Normal file
62
modules/clan/personal-computer/printing.nix
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
allowManageGroups = [
|
||||
"root"
|
||||
"wheel"
|
||||
"lpadmin"
|
||||
];
|
||||
polkitAllowGroups = builtins.concatStringsSep "||" (
|
||||
builtins.map (group: ''subject.isInGroup("${group}")'') allowManageGroups
|
||||
);
|
||||
|
||||
printerMember = lib.map (user: user.name) (
|
||||
lib.attrsets.attrsToList (
|
||||
lib.attrsets.filterAttrs (name: value: value.isNormalUser) config.users.users
|
||||
)
|
||||
);
|
||||
|
||||
in
|
||||
{
|
||||
services.printing = {
|
||||
enable = true;
|
||||
drivers = [
|
||||
pkgs.brlaser
|
||||
pkgs.gutenprint
|
||||
];
|
||||
|
||||
extraFilesConf = ''
|
||||
SystemGroup ${builtins.concatStringsSep " " allowManageGroups}
|
||||
'';
|
||||
};
|
||||
|
||||
security.polkit = {
|
||||
enable = true;
|
||||
|
||||
extraConfig = ''
|
||||
polkit.addRule(function(action, subject) {
|
||||
var actionMatchs = (
|
||||
action.id.indexOf('org.opensuse.cupspkhelper.mechanism.') === 0
|
||||
);
|
||||
if (actionMatchs) {
|
||||
if (${polkitAllowGroups}) {
|
||||
return polkit.Result.YES
|
||||
}
|
||||
}
|
||||
});
|
||||
'';
|
||||
};
|
||||
|
||||
hardware.sane = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
users.groups.lpadmin.members = printerMember;
|
||||
users.groups.lp.members = printerMember;
|
||||
users.groups.scanner.members = printerMember;
|
||||
|
||||
}
|
||||
11
modules/clan/personal-computer/users.nix
Normal file
11
modules/clan/personal-computer/users.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
users.mutableUsers = lib.mkForce true;
|
||||
security.polkit.extraConfig = ''
|
||||
polkit.addRule(function(action, subject) {
|
||||
if ((action.id == "org.freedesktop.accounts.change-own-password")) {
|
||||
return polkit.Result.AUTH_SELF;
|
||||
}
|
||||
});
|
||||
'';
|
||||
}
|
||||
4
modules/clan/personal-computer/wireless.nix
Normal file
4
modules/clan/personal-computer/wireless.nix
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
networking.networkmanager.enable = true;
|
||||
hardware.bluetooth.enable = true;
|
||||
}
|
||||
Reference in New Issue
Block a user