modules: create home/common module
This commit is contained in:
parent
90b454816c
commit
ba8cfc1fd5
8 changed files with 144 additions and 28 deletions
21
flake.lock
generated
21
flake.lock
generated
|
@ -141,6 +141,26 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"firefox-darwin": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1705884384,
|
||||||
|
"narHash": "sha256-bi1bK24N9LbYnkJfv7K/YTy+RCsxNsdlTvBqqWj46lg=",
|
||||||
|
"owner": "bandithedoge",
|
||||||
|
"repo": "nixpkgs-firefox-darwin",
|
||||||
|
"rev": "5cc14069cb1da102f13483666aed9e91fbaac255",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "bandithedoge",
|
||||||
|
"repo": "nixpkgs-firefox-darwin",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"fl-config": {
|
"fl-config": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1653159448,
|
"lastModified": 1653159448,
|
||||||
|
@ -512,6 +532,7 @@
|
||||||
"darwin": "darwin",
|
"darwin": "darwin",
|
||||||
"disko": "disko",
|
"disko": "disko",
|
||||||
"fenix": "fenix",
|
"fenix": "fenix",
|
||||||
|
"firefox-darwin": "firefox-darwin",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"hercules-ci-agent": "hercules-ci-agent",
|
"hercules-ci-agent": "hercules-ci-agent",
|
||||||
"hercules-ci-effects": "hercules-ci-effects",
|
"hercules-ci-effects": "hercules-ci-effects",
|
||||||
|
|
|
@ -99,6 +99,10 @@
|
||||||
url = "github:ipetkov/crane";
|
url = "github:ipetkov/crane";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
firefox-darwin = {
|
||||||
|
url = "github:bandithedoge/nixpkgs-firefox-darwin";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
|
|
|
@ -2,5 +2,6 @@
|
||||||
imports = [
|
imports = [
|
||||||
./system
|
./system
|
||||||
./flake
|
./flake
|
||||||
|
./home
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
49
modules/home/common/default.nix
Normal file
49
modules/home/common/default.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# TODO: Make this module not rely on OS config being present
|
||||||
|
{
|
||||||
|
osConfig,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
inputs',
|
||||||
|
machineName,
|
||||||
|
...
|
||||||
|
} @ args: let
|
||||||
|
# TODO: Conditionally define based on whether we're in a system configuration or not
|
||||||
|
fishOverlayModule = lib.mkIf (!args ? osConfig) {
|
||||||
|
# See modules/system/common/default.nix for reasoning.
|
||||||
|
nixpkgs.overlays = [(_: _: {inherit (inputs'.settei.packages) fish;})];
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
_file = ./default.nix;
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
./desktop
|
||||||
|
fishOverlayModule
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.fish.enable = true;
|
||||||
|
programs.direnv.enable = true;
|
||||||
|
programs.nix-index.enable = true;
|
||||||
|
programs.ssh.enable = true;
|
||||||
|
programs.zoxide.enable = true;
|
||||||
|
programs.ripgrep.enable = true;
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
difftastic.enable = true;
|
||||||
|
lfs.enable = true;
|
||||||
|
userName = "Nikodem Rabuliński";
|
||||||
|
userEmail = lib.mkDefault "nikodem@rabulinski.com";
|
||||||
|
# TODO: settei options for home-manager module
|
||||||
|
signing = {
|
||||||
|
key = osConfig.settei.sane-defaults.allSshKeys.${machineName};
|
||||||
|
signByDefault = true;
|
||||||
|
};
|
||||||
|
extraConfig = {
|
||||||
|
gpg.format = "ssh";
|
||||||
|
push.followTags = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
home.packages = [inputs'.settei.packages.base-packages pkgs.nh];
|
||||||
|
|
||||||
|
home.sessionVariables.EDITOR = "hx";
|
||||||
|
}
|
53
modules/home/common/desktop/default.nix
Normal file
53
modules/home/common/desktop/default.nix
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
_file = ./default.nix;
|
||||||
|
|
||||||
|
options.common.desktop = {
|
||||||
|
enable = lib.mkEnableOption "Common configuration for desktop machines";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.common.desktop.enable {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
nerdfonts
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.firefox = {
|
||||||
|
enable = true;
|
||||||
|
package = let
|
||||||
|
firefox-pkgs = pkgs.extend inputs.firefox-darwin.overlay;
|
||||||
|
in
|
||||||
|
lib.mkIf pkgs.stdenv.isDarwin firefox-pkgs.firefox-bin;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.alacritty = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
cursor.style.shape = "Beam";
|
||||||
|
window = {
|
||||||
|
option_as_alt = lib.mkIf pkgs.stdenv.isDarwin "Both";
|
||||||
|
decorations =
|
||||||
|
if pkgs.stdenv.isDarwin
|
||||||
|
then "Buttonless"
|
||||||
|
else "None";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.zellij = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
keybinds = {
|
||||||
|
shared_except = {
|
||||||
|
_args = ["locked"];
|
||||||
|
unbind = "Ctrl q";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
5
modules/home/default.nix
Normal file
5
modules/home/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
flake.homeModules = {
|
||||||
|
common = ./common;
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
configurationName,
|
configurationName,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
inputs,
|
||||||
inputs',
|
inputs',
|
||||||
username,
|
username,
|
||||||
...
|
...
|
||||||
|
@ -16,32 +17,10 @@
|
||||||
};
|
};
|
||||||
flake-qol.enable = true;
|
flake-qol.enable = true;
|
||||||
user = {
|
user = {
|
||||||
enable = true;
|
enable = lib.mkDefault true;
|
||||||
config = {
|
# TODO: Move to settei or leave here?
|
||||||
home.packages = let
|
extraArgs.machineName = configurationName;
|
||||||
extraPkgs = [pkgs.nh];
|
config.imports = [inputs.settei.homeModules.common];
|
||||||
in
|
|
||||||
[inputs'.settei.packages.base-packages] ++ extraPkgs;
|
|
||||||
|
|
||||||
home.sessionVariables.EDITOR = "hx";
|
|
||||||
programs.git = {
|
|
||||||
enable = true;
|
|
||||||
difftastic.enable = true;
|
|
||||||
lfs.enable = true;
|
|
||||||
userName = "Nikodem Rabuliński";
|
|
||||||
userEmail = lib.mkDefault "nikodem@rabulinski.com";
|
|
||||||
signing = {
|
|
||||||
key = config.settei.sane-defaults.allSshKeys.${configurationName};
|
|
||||||
signByDefault = true;
|
|
||||||
};
|
|
||||||
extraConfig = {
|
|
||||||
gpg.format = "ssh";
|
|
||||||
push.followTags = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.fish.enable = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
options,
|
options,
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
} @ args: let
|
||||||
hasHomeManager = options ? home-manager;
|
hasHomeManager = options ? home-manager;
|
||||||
cfg = config.settei.user;
|
cfg = config.settei.user;
|
||||||
inherit (config.settei) username;
|
inherit (config.settei) username;
|
||||||
|
@ -26,7 +26,11 @@ in {
|
||||||
hmConfig = lib.optionalAttrs hasHomeManager {
|
hmConfig = lib.optionalAttrs hasHomeManager {
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.extraSpecialArgs = cfg.extraArgs;
|
home-manager.extraSpecialArgs =
|
||||||
|
{
|
||||||
|
inherit (args) inputs inputs';
|
||||||
|
}
|
||||||
|
// cfg.extraArgs;
|
||||||
|
|
||||||
home-manager.users.${username} = {
|
home-manager.users.${username} = {
|
||||||
_file = ./user.nix;
|
_file = ./user.nix;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue