refactor: use inputs.self instead of rel. paths

This commit is contained in:
Swarsel 2024-12-05 02:36:25 +01:00
parent 83bc6af1f6
commit 33046cb4a3
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
19 changed files with 1067 additions and 1711 deletions

View file

@ -1,6 +1,7 @@
{ lib, pkgs, config, ... }:
_:
{
imports = [
imports = [
./settings.nix
./packages.nix
./custom-packages.nix
./sops.nix
@ -34,28 +35,4 @@
./zellij.nix
./tmux.nix
];
nix = {
package = lib.mkDefault pkgs.nix;
settings = {
experimental-features = [
"nix-command"
"flakes"
"ca-derivations"
];
};
};
programs.home-manager.enable = lib.mkIf (!config.swarselsystems.isNixos) true;
home = {
username = lib.mkDefault "swarsel";
homeDirectory = lib.mkDefault "/home/${config.home.username}";
stateVersion = lib.mkDefault "23.05";
keyboard.layout = "us";
sessionVariables = {
FLAKE = "$HOME/.dotfiles";
};
};
}

View file

@ -1,11 +1,11 @@
{ pkgs, ... }:
{ self, pkgs, ... }:
{
# enable emacs overlay for bleeding edge features
# also read init.el file and install use-package packages
programs.emacs = {
enable = true;
package = pkgs.emacsWithPackagesFromUsePackage {
config = ../../../programs/emacs/init.el;
config = self + /programs/emacs/init.el;
package = pkgs.emacs-pgtk;
alwaysEnsure = true;
alwaysTangle = true;

View file

@ -1,11 +1,11 @@
{ pkgs, ... }:
{ self, pkgs, ... }:
{
programs.nix-index =
let
commandNotFound = pkgs.runCommandLocal "command-not-found.sh" { } ''
mkdir -p $out/etc/profile.d
substitute ${../../../scripts/command-not-found.sh} \
$out/etc/profile.d/command-not-found.sh \
substitute ${self + /scripts/command-not-found.sh} \
$out/etc/profile.d/command-not-found.sh \
--replace @nix-locate@ ${pkgs.nix-index}/bin/nix-locate \
--replace @tput@ ${pkgs.ncurses}/bin/tput
'';

View file

@ -0,0 +1,25 @@
{ lib, config, pkgs, ... }:
{
nix = {
package = lib.mkDefault pkgs.nix;
settings = {
experimental-features = [
"nix-command"
"flakes"
"ca-derivations"
];
};
};
programs.home-manager.enable = lib.mkIf (!config.swarselsystems.isNixos) true;
home = {
username = lib.mkDefault "swarsel";
homeDirectory = lib.mkDefault "/home/${config.home.username}";
stateVersion = lib.mkDefault "23.05";
keyboard.layout = "us";
sessionVariables = {
FLAKE = "$HOME/.dotfiles";
};
};
}

View file

@ -1,31 +1,31 @@
_:
{ self, ... }:
{
home.file = {
"init.el" = {
source = ../../../programs/emacs/init.el;
source = self + /programs/emacs/init.el;
target = ".emacs.d/init.el";
};
"early-init.el" = {
source = ../../../programs/emacs/early-init.el;
source = self + /programs/emacs/early-init.el;
target = ".emacs.d/early-init.el";
};
# on NixOS, Emacs does not find the aspell dicts easily. Write the configuration manually
".aspell.conf" = {
source = ../../../programs/config/.aspell.conf;
source = self + /programs/config/.aspell.conf;
target = ".aspell.conf";
};
".gitmessage" = {
source = ../../../programs/git/.gitmessage;
source = self + /programs/git/.gitmessage;
target = ".gitmessage";
};
"swayidle/config" = {
source = ../../../programs/swayidle/config;
source = self + /programs/swayidle/config;
target = ".config/swayidle/config";
};
};
xdg.configFile = {
"tridactyl/tridactylrc".source = ../../../programs/firefox/tridactyl/tridactylrc;
"tridactyl/themes/base16-codeschool.css".source = ../../../programs/firefox/tridactyl/themes/base16-codeschool.css;
"tridactyl/tridactylrc".source = self + /programs/firefox/tridactyl/tridactylrc;
"tridactyl/themes/base16-codeschool.css".source = self + /programs/firefox/tridactyl/themes/base16-codeschool.css;
};
}

View file

@ -1,4 +1,4 @@
{ config, lib, ... }:
{ self, config, lib, ... }:
{
programs.waybar = {
@ -259,6 +259,6 @@
};
};
};
style = builtins.readFile ../../../programs/waybar/style.css;
style = builtins.readFile (self + /programs/waybar/style.css);
};
}

View file

@ -1,6 +1,7 @@
{ lib, inputs, ... }:
_:
{
imports = [
./settings.nix
./xserver.nix
./users.nix
./env.nix
@ -38,35 +39,9 @@
./lid.nix
];
nix =
let
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
in
{
settings = {
experimental-features = [
"nix-command"
"flakes"
"ca-derivations"
];
trusted-users = [ "swarsel" ];
flake-registry = "";
warn-dirty = false;
};
channel.enable = false;
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
nixpkgs.config.permittedInsecurePackages = [
"jitsi-meet-1.0.8043"
"electron-29.4.6"
];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
};
system.stateVersion = lib.mkDefault "23.05";
}

View file

@ -226,7 +226,7 @@
proxy = { };
wifi = {
mode = "ap";
ssid = "Hotspot-fourside";
ssid = "Hotspot-swarsel";
};
wifi-security = {
group = "ccmp;";

View file

@ -9,4 +9,5 @@ _:
};
security.polkit.enable = true;
}

View file

@ -0,0 +1,31 @@
{ self, lib, inputs, ... }:
{
nix =
let
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
in
{
settings = {
experimental-features = [
"nix-command"
"flakes"
"ca-derivations"
];
trusted-users = [ "swarsel" ];
flake-registry = "";
warn-dirty = false;
};
channel.enable = false;
registry = lib.mapAttrs (_: flake: { inherit flake; }) flakeInputs;
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = inputs; # used mainly for inputs.self
};
system.stateVersion = lib.mkDefault "23.05";
}