Massive restructure
This commit is contained in:
parent
e783f8c45b
commit
a81cca3e20
2
home.nix
2
home.nix
|
@ -1,5 +1,5 @@
|
||||||
let
|
let
|
||||||
inherit (import <nixpkgs> { }) lib;
|
inherit (import (import ./nix/sources.nix).nixpkgs { }) lib;
|
||||||
modes = import home/modes.nix;
|
modes = import home/modes.nix;
|
||||||
in lib.listToAttrs (lib.flatten (lib.mapAttrsToList (host: configs:
|
in lib.listToAttrs (lib.flatten (lib.mapAttrsToList (host: configs:
|
||||||
lib.mapAttrsToList (mode: config: {
|
lib.mapAttrsToList (mode: config: {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ ... }: {
|
{ pkgs, ... }: {
|
||||||
home.file.".config/jali/config.py".text =
|
home.file.".config/jali/config.py".source = ../common/secret/jaliconfig.py;
|
||||||
builtins.readFile ../common/secret/jaliconfig.py;
|
home.packages = builtins.attrValues pkgs.accounting-pkgs;
|
||||||
home.packages = builtins.attrValues (import ../pkgs).accounting-pkgs;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{ lib, pkgs, config, ... }:
|
{ lib, pkgs, config, ... }:
|
||||||
let
|
let
|
||||||
inherit (import ../lib/default.nix) writeHaskellScript;
|
battery-watch = pkgs.writeHaskellScript {
|
||||||
battery-watch = writeHaskellScript {
|
|
||||||
name = "battery-watch";
|
name = "battery-watch";
|
||||||
libraries = [
|
libraries = [
|
||||||
pkgs.haskellPackages.fdo-notify
|
pkgs.haskellPackages.fdo-notify
|
||||||
|
|
|
@ -1,21 +1,19 @@
|
||||||
{ pkgs, config, ... }:
|
{ pkgs, config, lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (config.m-0.private) me meWork;
|
inherit (config.m-0.private) me meWork;
|
||||||
inherit (import ../lib) writeHaskellScript;
|
|
||||||
my-pkgs = import ../pkgs;
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./zsh
|
./zsh
|
||||||
./update-script.nix
|
|
||||||
./taskwarrior.nix
|
./taskwarrior.nix
|
||||||
./modules/home-options.nix
|
./home-options.nix
|
||||||
../common
|
../common
|
||||||
./unlock.nix
|
./unlock.nix
|
||||||
./mpclient.nix
|
./mpclient.nix
|
||||||
./neovim
|
./neovim
|
||||||
];
|
];
|
||||||
services.gpg-agent.enable = true;
|
services.gpg-agent.enable = true;
|
||||||
|
nixpkgs.overlays = import ../overlays.nix { inherit lib; };
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
home-manager.enable = true;
|
home-manager.enable = true;
|
||||||
|
@ -37,7 +35,8 @@ in {
|
||||||
package = pkgs.pass-wayland.withExtensions
|
package = pkgs.pass-wayland.withExtensions
|
||||||
(exts: [ exts.pass-update pkgs.pass-clip ]);
|
(exts: [ exts.pass-update pkgs.pass-clip ]);
|
||||||
enable = true;
|
enable = true;
|
||||||
settings.PASSWORD_STORE_DIR = "${config.home.homeDirectory}/git/password-store";
|
settings.PASSWORD_STORE_DIR =
|
||||||
|
"${config.home.homeDirectory}/git/password-store";
|
||||||
};
|
};
|
||||||
git = {
|
git = {
|
||||||
aliases = { sync = "!git pull -r && git push"; };
|
aliases = { sync = "!git pull -r && git push"; };
|
||||||
|
@ -134,7 +133,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
packages = builtins.attrValues my-pkgs.home-pkgs;
|
packages = builtins.attrValues pkgs.home-pkgs;
|
||||||
sessionVariables = {
|
sessionVariables = {
|
||||||
PATH =
|
PATH =
|
||||||
"$HOME/.cargo/bin:/etc/profiles/per-user/${config.home.username}/bin:$HOME/.nix-profile/bin:$PATH";
|
"$HOME/.cargo/bin:/etc/profiles/per-user/${config.home.username}/bin:$HOME/.nix-profile/bin:$PATH";
|
||||||
|
@ -145,9 +144,7 @@ in {
|
||||||
"pass show eu/m-0/${config.m-0.hostName}.m-0.eu/${config.home.username}";
|
"pass show eu/m-0/${config.m-0.hostName}.m-0.eu/${config.home.username}";
|
||||||
in "${print-pw}/bin/print-pw";
|
in "${print-pw}/bin/print-pw";
|
||||||
};
|
};
|
||||||
file.".direnvrc".text = ''
|
file.".direnvrc".text = "source ${pkgs.sources.nix-direnv}/direnvrc";
|
||||||
source ${my-pkgs.nix-direnv}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user = { startServices = true; };
|
systemd.user = { startServices = true; };
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
{ pkgs, lib, config, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
let
|
let inherit (import ../../lib) colors;
|
||||||
inherit (import ../../pkgs) desktop-pkgs;
|
|
||||||
inherit (import ../../lib) colors;
|
|
||||||
in {
|
in {
|
||||||
imports = [ ./sleep-nag.nix ./kitty.nix ./wallpaper.nix ./gnome.nix ./firefox.nix ];
|
imports =
|
||||||
|
[ ./sleep-nag.nix ./kitty.nix ./wallpaper.nix ./gnome.nix ./firefox.nix ];
|
||||||
m-0.colors = colors;
|
m-0.colors = colors;
|
||||||
home = {
|
home = {
|
||||||
packages = builtins.attrValues desktop-pkgs;
|
packages = builtins.attrValues pkgs.desktop-pkgs;
|
||||||
file.".zprofile".text =
|
file.".zprofile".text =
|
||||||
". $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh";
|
". $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh";
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{ lib, pkgs, config, ... }:
|
{ pkgs, ... }:
|
||||||
let
|
let
|
||||||
inherit (import ../../lib) writeHaskellScript;
|
sleep-nag = pkgs.writeHaskellScript {
|
||||||
sleep-nag = writeHaskellScript {
|
|
||||||
name = "sleep-nag";
|
name = "sleep-nag";
|
||||||
imports = [
|
imports = [
|
||||||
"Data.Time.LocalTime"
|
"Data.Time.LocalTime"
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{ lib, pkgs, config, ... }:
|
{ pkgs, ... }:
|
||||||
let
|
let
|
||||||
inherit (import ../../lib) writeHaskellScript;
|
randomWallpaper = pkgs.writeHaskellScript {
|
||||||
randomWallpaper = writeHaskellScript {
|
|
||||||
name = "random-wallpaper";
|
name = "random-wallpaper";
|
||||||
imports = [ "System.Random" ];
|
imports = [ "System.Random" ];
|
||||||
bins = [ pkgs.coreutils pkgs.glib ];
|
bins = [ pkgs.coreutils pkgs.glib ];
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }:
|
||||||
let inherit (import ../lib) unfreePkgs writeHaskellScript;
|
{
|
||||||
in {
|
|
||||||
|
|
||||||
dconf.settings."org/gnome/settings-daemon/plugins/media-keys" = {
|
dconf.settings."org/gnome/settings-daemon/plugins/media-keys" = {
|
||||||
mic-mute = lib.mkForce [ ];
|
mic-mute = lib.mkForce [ ];
|
||||||
|
@ -50,7 +49,7 @@ in {
|
||||||
vulkan-tools
|
vulkan-tools
|
||||||
]);
|
]);
|
||||||
runScript = let
|
runScript = let
|
||||||
gw2wrapper = writeHaskellScript {
|
gw2wrapper = pkgs.writeHaskellScript {
|
||||||
name = "gw2wrapper";
|
name = "gw2wrapper";
|
||||||
bins = [ pkgs.procps ];
|
bins = [ pkgs.procps ];
|
||||||
imports = [ "System.Directory (withCurrentDirectory)" ];
|
imports = [ "System.Directory (withCurrentDirectory)" ];
|
||||||
|
|
17
home/home-options.nix
Normal file
17
home/home-options.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ lib, ... }: {
|
||||||
|
|
||||||
|
options = {
|
||||||
|
m-0 = {
|
||||||
|
hostName = lib.mkOption { type = lib.types.str; };
|
||||||
|
terminal = lib.mkOption {
|
||||||
|
default = "kitty";
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
colors = lib.mkOption {
|
||||||
|
default = { };
|
||||||
|
type = lib.types.attrs;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (import ../lib) writeHaskellScript;
|
|
||||||
modes = pkgs.lib.attrNames (import ./modes.nix).apollo;
|
modes = pkgs.lib.attrNames (import ./modes.nix).apollo;
|
||||||
autostart-script = pkgs.writeShellScriptBin "home-manager-autostart" ''
|
autostart-script = pkgs.writeShellScriptBin "home-manager-autostart" ''
|
||||||
${pkgs.xorg.xrdb}/bin/xrdb ${builtins.toFile "Xresources" "Xft.dpi: 96"}
|
${pkgs.xorg.xrdb}/bin/xrdb ${builtins.toFile "Xresources" "Xft.dpi: 96"}
|
||||||
|
@ -24,7 +23,7 @@ in {
|
||||||
sudo -A nix-collect-garbage -d
|
sudo -A nix-collect-garbage -d
|
||||||
sudo -A nix optimise-store
|
sudo -A nix optimise-store
|
||||||
'';
|
'';
|
||||||
activateMode = writeHaskellScript { name = "activate-mode"; } ''
|
activateMode = pkgs.writeHaskellScript { name = "activate-mode"; } ''
|
||||||
getMode :: IO Text
|
getMode :: IO Text
|
||||||
getMode = decodeUtf8 <$> (cat "/home/maralorn/volatile/mode" |> captureTrim)
|
getMode = decodeUtf8 <$> (cat "/home/maralorn/volatile/mode" |> captureTrim)
|
||||||
|
|
||||||
|
@ -34,7 +33,7 @@ in {
|
||||||
exe ([i|/home/maralorn/.modes/#{mode}/activate|] :: String)
|
exe ([i|/home/maralorn/.modes/#{mode}/activate|] :: String)
|
||||||
exe "random-wallpaper"
|
exe "random-wallpaper"
|
||||||
'';
|
'';
|
||||||
updateModes = writeHaskellScript {
|
updateModes = pkgs.writeHaskellScript {
|
||||||
name = "update-modes";
|
name = "update-modes";
|
||||||
bins = [ activateMode ];
|
bins = [ activateMode ];
|
||||||
} ''
|
} ''
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{ lib, config, pkgs, ... }:
|
{ lib, config, pkgs, ... }:
|
||||||
let
|
let
|
||||||
inherit (import ../lib) writeHaskellScript;
|
|
||||||
inherit (config.m-0.private) sendmail me;
|
inherit (config.m-0.private) sendmail me;
|
||||||
inherit (config.m-0.private.mail_filters) sortLists stupidLists notifications;
|
inherit (config.m-0.private.mail_filters) sortLists stupidLists notifications;
|
||||||
maildir = config.accounts.email.maildirBasePath;
|
maildir = config.accounts.email.maildirBasePath;
|
||||||
|
@ -25,7 +24,7 @@ let
|
||||||
myFilters = builtins.map filter.simpleSortList sortLists
|
myFilters = builtins.map filter.simpleSortList sortLists
|
||||||
++ builtins.map filter.stupidList stupidLists
|
++ builtins.map filter.stupidList stupidLists
|
||||||
++ builtins.map filter.notifications notifications;
|
++ builtins.map filter.notifications notifications;
|
||||||
sortMail = writeHaskellScript {
|
sortMail = pkgs.writeHaskellScript {
|
||||||
name = "sort-mail-archive";
|
name = "sort-mail-archive";
|
||||||
bins = [ pkgs.notmuch pkgs.coreutils pkgs.mblaze pkgs.findutils ];
|
bins = [ pkgs.notmuch pkgs.coreutils pkgs.mblaze pkgs.findutils ];
|
||||||
libraries = [ pkgs.haskellPackages.megaparsec ];
|
libraries = [ pkgs.haskellPackages.megaparsec ];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
let
|
let
|
||||||
inherit (import <nixpkgs> { }) lib;
|
inherit (import (import ../nix/sources.nix).nixpkgs { }) lib;
|
||||||
makeConfig = hostName: imports:
|
makeConfig = hostName: imports:
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
imports = imports ++ [ ./default.nix ];
|
imports = imports ++ [ ./default.nix ];
|
||||||
|
@ -90,7 +90,6 @@ in {
|
||||||
|
|
||||||
tinkering = apolloConfig [
|
tinkering = apolloConfig [
|
||||||
./mail-client.nix
|
./mail-client.nix
|
||||||
./update-script.nix
|
|
||||||
./tinkering.nix
|
./tinkering.nix
|
||||||
./chat.nix
|
./chat.nix
|
||||||
(makeBlock leisurePages)
|
(makeBlock leisurePages)
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
{ config, lib, pkgs, ... }:
|
|
||||||
with lib;
|
|
||||||
let inherit (config.m-0.private) me gitlab github otrs;
|
|
||||||
in {
|
|
||||||
options.m-0.bugwarrior.enable =
|
|
||||||
mkEnableOption "Sync tasks from issuetrackers";
|
|
||||||
config = mkIf config.m-0.bugwarrior.enable {
|
|
||||||
home.file.".config/bugwarrior/bugwarriorrc".text = ''
|
|
||||||
[general]
|
|
||||||
targets=cda_gitlab,github
|
|
||||||
static_fields = priority, project
|
|
||||||
|
|
||||||
[cda_gitlab]
|
|
||||||
service=gitlab
|
|
||||||
gitlab.password=@oracle:eval:pass de/darmstadt/ccc/ldap
|
|
||||||
gitlab.login=${me.user}
|
|
||||||
gitlab.host=${gitlab.host}
|
|
||||||
gitlab.token=${gitlab.token}
|
|
||||||
gitlab.only_if_assigned=${me.user}
|
|
||||||
gitlab.also_unassigned=True
|
|
||||||
gitlab.default_priority= L
|
|
||||||
gitlab.include_repos=cda/tasks, cda/chaos-darmstadt.de, cda/doku
|
|
||||||
gitlab.include_regex=(vorstand|jali|${me.user})/.*,
|
|
||||||
gitlab.description_template = {{gitlabnamespace}}/{{gitlabrepo}} {{gitlabtype[:1]}}#{{gitlabnumber}}: {{gitlabtitle}}
|
|
||||||
gitlab.project_template =
|
|
||||||
|
|
||||||
[github]
|
|
||||||
service=github
|
|
||||||
github.login = ${me.user}
|
|
||||||
github.username = ${me.user}
|
|
||||||
github.token = ${github.token}
|
|
||||||
github.description_template = {{githubrepo}} {{githubtype[:1]}}#{{githubnumber}}: {{githubtitle}}
|
|
||||||
github.include_user_issues = False
|
|
||||||
github.include_user_repos = False
|
|
||||||
github.query = is:open involves:maralorn archived:false -repo:maxtaco/coffee-script -repo:QMatrixClient/libqmatrixclient -repo:QMatrixClient/Quaternion -repo:trollhoehle/pythonlights -repo:MirakelX/mirakel-android
|
|
||||||
github.default_priority= L
|
|
||||||
github.project_template =
|
|
||||||
'';
|
|
||||||
systemd.user = {
|
|
||||||
services.bugwarrior = {
|
|
||||||
Unit = { Description = "Run bugwarrior"; };
|
|
||||||
Service = {
|
|
||||||
Type = "oneshot";
|
|
||||||
Environment =
|
|
||||||
"PATH=${pkgs.taskwarrior}/bin:${pkgs.eventd}/bin:${pkgs.gnugrep}/bin";
|
|
||||||
ExecStart = "${pkgs.bugwarrior}/bin/bugwarrior-pull";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
timers.bugwarrior = {
|
|
||||||
Timer = { OnCalendar = "hourly"; };
|
|
||||||
Install = { WantedBy = [ "timers.target" ]; };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
{ lib, config, ... }:
|
|
||||||
let
|
|
||||||
paths = config.home.forceCopies.paths;
|
|
||||||
disableCollisionCheck = path: ''
|
|
||||||
if [[ -a $HOME/${path} ]]; then
|
|
||||||
echo "Removing $HOME/${path}" because it is probably from a previous generation.
|
|
||||||
rm -f $HOME/${path}
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
copyPath = path: ''
|
|
||||||
canonical=`readlink -f $newGenPath/home-files/${path}`
|
|
||||||
if [[ ! -a $canonical ]]; then
|
|
||||||
echo "File $newGenPath/home-files/${path} does not exist."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ ! -a $HOME/${path} ]]; then
|
|
||||||
echo "There is no file at $HOME/${path} this is weird."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Overwriting $HOME/${path}"
|
|
||||||
cp --remove-destination -T $canonical $HOME/${path};
|
|
||||||
'';
|
|
||||||
in with lib; {
|
|
||||||
options.home.forceCopies.paths = mkOption {
|
|
||||||
default = [ ];
|
|
||||||
type = types.listOf types.str;
|
|
||||||
};
|
|
||||||
config.home.activation = {
|
|
||||||
deleteForcedCopies = config.lib.dag.entryBefore [ "checkLinkTargets" ]
|
|
||||||
(builtins.concatStringsSep "\n"
|
|
||||||
(builtins.map disableCollisionCheck paths));
|
|
||||||
forceCopies = config.lib.dag.entryAfter [ "linkGeneration" ]
|
|
||||||
(builtins.concatStringsSep "\n" (builtins.map copyPath paths));
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
{ lib, config, pkgs, ... }:
|
|
||||||
with lib; {
|
|
||||||
|
|
||||||
options = {
|
|
||||||
m-0 = {
|
|
||||||
hostName = mkOption { type = types.str; };
|
|
||||||
terminal = mkOption {
|
|
||||||
default = "urxvt";
|
|
||||||
type = types.str;
|
|
||||||
};
|
|
||||||
colors = mkOption {
|
|
||||||
default = { };
|
|
||||||
type = types.attrs;
|
|
||||||
};
|
|
||||||
workspaces = mkOption {
|
|
||||||
default = [ "configure some workspaces" ];
|
|
||||||
type = types.listOf types.str;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
let inherit (import ../lib) writeHaskellScript sources;
|
|
||||||
in {
|
|
||||||
home = {
|
|
||||||
packages = builtins.attrValues (import ../pkgs).foreign-home-pkgs;
|
|
||||||
sessionVariables = { NIX_PATH = "$HOME/.nix-path"; };
|
|
||||||
file = {
|
|
||||||
home-manager-source = {
|
|
||||||
target = ".nix-path/home-manager";
|
|
||||||
source = sources.home-manager;
|
|
||||||
};
|
|
||||||
nixpkgsr-source = {
|
|
||||||
target = ".nix-path/nixpkgs";
|
|
||||||
source = sources.nixpkgs;
|
|
||||||
};
|
|
||||||
nixos = {
|
|
||||||
target = ".nix-path/nixos";
|
|
||||||
source = sources.nixpkgs;
|
|
||||||
};
|
|
||||||
unstable = {
|
|
||||||
target = ".nix-path/unstable";
|
|
||||||
source = sources.unstable;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -2,6 +2,6 @@
|
||||||
home = {
|
home = {
|
||||||
username = "maralorn";
|
username = "maralorn";
|
||||||
homeDirectory = "/home/maralorn";
|
homeDirectory = "/home/maralorn";
|
||||||
packages = builtins.attrValues (import ../pkgs).my-home-pkgs;
|
packages = builtins.attrValues pkgs.my-home-pkgs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
let
|
let
|
||||||
inherit (import <nixpkgs> { }) lib pkgs;
|
inherit (import (import ../nix/sources.nix).nixpkgs { }) lib pkgs;
|
||||||
modes = import ./modes.nix;
|
modes = import ./modes.nix;
|
||||||
home-manager = import <home-manager/home-manager/home-manager.nix>;
|
home-manager = import <home-manager/home-manager/home-manager.nix>;
|
||||||
buildHomeManager = attr:
|
buildHomeManager = attr:
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
Bool a -> show a
|
Bool a -> show a
|
||||||
Null -> "null"
|
Null -> "null"
|
||||||
'';
|
'';
|
||||||
inherit (import ../lib) writeHaskellScript;
|
inherit (pkgs) writeHaskellScript;
|
||||||
libraries = [
|
libraries = [
|
||||||
pkgs.haskellPackages.fdo-notify
|
pkgs.haskellPackages.fdo-notify
|
||||||
pkgs.haskellPackages.aeson
|
pkgs.haskellPackages.aeson
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
home.packages = builtins.attrValues {
|
home.packages = builtins.attrValues {
|
||||||
inherit (pkgs.xorg) xev;
|
inherit (pkgs.xorg) xev;
|
||||||
inherit (pkgs.gitAndTools) hub;
|
inherit (pkgs.gitAndTools) hub;
|
||||||
inherit (pkgs) meld icedtea8_web octave filezilla cachix nix-review gparted;
|
inherit (pkgs)
|
||||||
grafana-devel = pkgs.callPackage ../pkgs/grafana-devel.nix { };
|
meld icedtea8_web octave filezilla cachix nix-review gparted
|
||||||
|
grafana-devel;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
let
|
|
||||||
inherit (import ../lib) writeHaskellScript get-niv-path gcRetentionDays;
|
|
||||||
inherit (import ../lib/update-home.nix) update-home;
|
|
||||||
configPath = "/home/${config.home.username}/git/config";
|
|
||||||
in {
|
|
||||||
home = {
|
|
||||||
packages = builtins.attrValues {
|
|
||||||
inherit get-niv-path;
|
|
||||||
update-home = update-home configPath;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
Binary file not shown.
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
. ~/.nix-profile/etc/profile.d/nix.sh
|
|
||||||
. ~/.nix-profile/etc/profile.d/hm-session-vars.sh
|
|
||||||
exec "$@"
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
exec ~/bin/proot -b ~/.nix:/nix bin/run-in-nix $@
|
|
|
@ -1,66 +0,0 @@
|
||||||
{ pkgs, config, ... }: {
|
|
||||||
imports = [ ../../home ../../home/on-foreign-machine.nix ];
|
|
||||||
|
|
||||||
systemd.user.systemctlPath = "/usr/bin/systemctl";
|
|
||||||
|
|
||||||
m-0 = { hostName = "fb04217"; };
|
|
||||||
|
|
||||||
home = {
|
|
||||||
username = "brandy";
|
|
||||||
homeDirectory = "/home/brandy";
|
|
||||||
language = {
|
|
||||||
base = "C.UTF-8";
|
|
||||||
address = "C.UTF-8";
|
|
||||||
monetary = "C.UTF-8";
|
|
||||||
paper = "C.UTF-8";
|
|
||||||
time = "C.UTF-8";
|
|
||||||
};
|
|
||||||
sessionVariables = {
|
|
||||||
LANGUAGE = "en_US";
|
|
||||||
LC_CTYPE = "C.UTF-8";
|
|
||||||
LC_NUMERIC = "C.UTF-8";
|
|
||||||
LC_COLLATE = "C.UTF-8";
|
|
||||||
LC_MESSAGES = "C.UTF-8";
|
|
||||||
LC_NAME = "C.UTF-8";
|
|
||||||
LC_TELEPHONE = "C.UTF-8";
|
|
||||||
LC_MEASUREMENT = "C.UTF-8";
|
|
||||||
LC_IDENTIFICATION = "C.UTF-8";
|
|
||||||
};
|
|
||||||
forceCopies.paths =
|
|
||||||
[ "bin/proot" "bin/with-nix" "bin/run-in-nix" ".bashrc" ".zshrc" ];
|
|
||||||
file = {
|
|
||||||
".bashrc".text = ''
|
|
||||||
[ -z "$PS1" ] && return
|
|
||||||
unset __HM_SESS_VARS_SOURCED
|
|
||||||
if [[ -z "$NIX_PATH" ]]
|
|
||||||
then
|
|
||||||
exec ~/bin/with-nix zsh
|
|
||||||
else
|
|
||||||
exec zsh
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
"bin" = {
|
|
||||||
source = ./bootstrap-bin;
|
|
||||||
recursive = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
packages = [
|
|
||||||
(pkgs.writeShellScriptBin "maintenance" ''
|
|
||||||
set -e
|
|
||||||
cd ~/git/nixos/nixpkgs
|
|
||||||
git checkout nixos-local
|
|
||||||
git pull --no-edit upstream nixos-19.03
|
|
||||||
git pull --no-edit origin nixos-maralorn
|
|
||||||
cd ~/git/nixos/home-manager
|
|
||||||
git checkout home-manager-local
|
|
||||||
git pull --no-edit upstream release-19.03
|
|
||||||
git pull --no-edit origin home-manager-maralorn
|
|
||||||
home-manager switch
|
|
||||||
nix-collect-garbage --delete-older-than 5d
|
|
||||||
nix-store --optimise
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
{ pkgs, ... }: {
|
|
||||||
systemd.user = {
|
|
||||||
services.nix-gc = {
|
|
||||||
Unit = { Description = "Collect garbage"; };
|
|
||||||
|
|
||||||
Service = {
|
|
||||||
Type = "oneshot";
|
|
||||||
ExecStart =
|
|
||||||
"${pkgs.nix}/bin/nix-collect-garbage --delete-older-than 5d";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
timers.nix-gc = {
|
|
||||||
Timer = {
|
|
||||||
OnCalendar = "22:00";
|
|
||||||
Persistent = "true";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
{ pkgs, ... }: {
|
|
||||||
systemd.user = {
|
|
||||||
services.nix-update = {
|
|
||||||
Unit = { Description = "Update nix-channel"; };
|
|
||||||
|
|
||||||
Service = {
|
|
||||||
Type = "oneshot";
|
|
||||||
ExecStart = "${pkgs.nix}/bin/nix-channel --update";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
timers.nix-update = {
|
|
||||||
Timer = {
|
|
||||||
OnCalendar = "22:00";
|
|
||||||
Persistent = "true";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
{ pkgs, ... }: {
|
|
||||||
systemd.user = {
|
|
||||||
services.syncthing = {
|
|
||||||
Unit = {
|
|
||||||
Description = "Syncthing";
|
|
||||||
ConditionHost = "fb04217";
|
|
||||||
Wants = "syncthing-inotify.service";
|
|
||||||
};
|
|
||||||
|
|
||||||
Service = {
|
|
||||||
ExecStart =
|
|
||||||
"${pkgs.syncthing}/bin/syncthing -no-browser -no-restart -logflags=0";
|
|
||||||
Restart = "on-failure";
|
|
||||||
SuccessExitStatus = "3 4";
|
|
||||||
RestartForceExitStatus = "3 4";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -19,79 +19,4 @@ rec {
|
||||||
"white" = "#dddbff";
|
"white" = "#dddbff";
|
||||||
"brightWhite" = "#ffffff";
|
"brightWhite" = "#ffffff";
|
||||||
};
|
};
|
||||||
pkgs = import <nixpkgs> { };
|
|
||||||
haskellList = list: ''["${builtins.concatStringsSep ''", "'' list}"]'';
|
|
||||||
writeHaskellScript =
|
|
||||||
{ name ? "haskell-script", bins ? [ ], libraries ? [ ], imports ? [ ] }:
|
|
||||||
code:
|
|
||||||
pkgs.writers.makeBinWriter {
|
|
||||||
compileScript = ''
|
|
||||||
cp $contentPath ${name}.hs
|
|
||||||
${
|
|
||||||
pkgs.ghc.withPackages (_:
|
|
||||||
libraries ++ (builtins.attrValues {
|
|
||||||
inherit (pkgs.haskellPackages)
|
|
||||||
shh string-interpolate relude async say cmdargs text;
|
|
||||||
}))
|
|
||||||
}/bin/ghc ${name}.hs -threaded -Wall -Wno-unused-top-binds -Wno-missing-signatures -Wno-type-defaults -Wno-unused-imports -Werror
|
|
||||||
mv ${name} $out
|
|
||||||
${pkgs.binutils-unwrapped}/bin/strip --strip-unneeded "$out"
|
|
||||||
'';
|
|
||||||
} "/bin/${name}" ''
|
|
||||||
{-# LANGUAGE DeriveDataTypeable #-}
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
|
||||||
{-# LANGUAGE ExtendedDefaultRules #-}
|
|
||||||
{-# LANGUAGE MultiWayIf #-}
|
|
||||||
{-# LANGUAGE LambdaCase #-}
|
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
|
||||||
{-# LANGUAGE TupleSections #-}
|
|
||||||
|
|
||||||
import Shh
|
|
||||||
import Relude
|
|
||||||
import Say
|
|
||||||
import qualified Relude.Unsafe as Unsafe
|
|
||||||
import qualified Data.ByteString.Lazy as LBS
|
|
||||||
import qualified Data.ByteString as BS
|
|
||||||
import qualified Data.Text as Text
|
|
||||||
import System.Environment (getArgs)
|
|
||||||
import Control.Exception (bracket, try)
|
|
||||||
import Data.String.Interpolate (i)
|
|
||||||
import Control.Concurrent.Async
|
|
||||||
${builtins.concatStringsSep "\n" (map (x: "import ${x}") imports)}
|
|
||||||
|
|
||||||
-- Load binaries from Nix packages. The dependencies will be captured
|
|
||||||
-- in the closure.
|
|
||||||
loadFromBins (${
|
|
||||||
haskellList
|
|
||||||
(builtins.map toString (bins ++ [ pkgs.coreutils pkgs.nix ]))
|
|
||||||
} :: [String])
|
|
||||||
|
|
||||||
getNivPath :: Text -> Text -> IO Text
|
|
||||||
getNivPath sources channel = do
|
|
||||||
let expression = [i|(import #{sources}/nix/sources.nix).#{channel}|] :: String
|
|
||||||
nix_build ["-Q", "-E", expression, "--no-out-link"] &> devNull
|
|
||||||
escaped <- nix_instantiate ["--eval" :: String, "-E", [i|toString #{expression}|]] |> captureTrim
|
|
||||||
pure . Text.dropAround ('"' ==) . decodeUtf8 . trim $ escaped
|
|
||||||
|
|
||||||
myNixPath :: Text -> IO [String]
|
|
||||||
myNixPath path = (extraPaths ++) . concat <$> mapM getNivAssign ["home-manager", "nixpkgs", "unstable"]
|
|
||||||
where
|
|
||||||
tag name str = ["-I", [i|#{name :: Text}=#{str :: Text}|]] :: [String]
|
|
||||||
getNivAssign name = tag name <$> getNivPath path name
|
|
||||||
extraPaths = ["-I", [i|nixpkgs-overlays=#{path}/overlays|]]
|
|
||||||
|
|
||||||
main :: IO ()
|
|
||||||
${code}
|
|
||||||
'';
|
|
||||||
get-niv-path = writeHaskellScript { name = "get-niv-path"; } ''
|
|
||||||
main = do
|
|
||||||
[sources, channel] <- fmap toText <$> getArgs
|
|
||||||
path <- getNivPath sources channel
|
|
||||||
say path
|
|
||||||
'';
|
|
||||||
home-manager = pkgs.callPackage <home-manager/home-manager> { };
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
let inherit (import ./.) home-manager writeHaskellScript;
|
|
||||||
in {
|
|
||||||
update-home = configPath:
|
|
||||||
writeHaskellScript {
|
|
||||||
name = "update-home";
|
|
||||||
bins = [ home-manager ];
|
|
||||||
} ''
|
|
||||||
main = do
|
|
||||||
args <- getArgs
|
|
||||||
paths <- myNixPath "${configPath}"
|
|
||||||
home_manager $ paths ++ ["switch"] ++ fmap toString args
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -1,8 +1,7 @@
|
||||||
nixos-rebuild:
|
{ pkgs, nixos-rebuild }:
|
||||||
let inherit (import ../lib) writeHaskellScript;
|
let configPath = "/etc/nixos";
|
||||||
in rec {
|
in {
|
||||||
configPath = "/etc/nixos";
|
update-system = pkgs.writeHaskellScript {
|
||||||
update-system = writeHaskellScript {
|
|
||||||
name = "update-system";
|
name = "update-system";
|
||||||
bins = [ nixos-rebuild ];
|
bins = [ nixos-rebuild ];
|
||||||
} ''
|
} ''
|
||||||
|
|
11
overlays.nix
Normal file
11
overlays.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{ lib }:
|
||||||
|
let
|
||||||
|
overlayPath = ./overlays;
|
||||||
|
candidates = lib.attrNames (builtins.readDir overlayPath);
|
||||||
|
pathToOverlay = n: overlayPath + ("/" + n);
|
||||||
|
isNixFile = n: builtins.match ".*\\.nix" n != null;
|
||||||
|
isNixDir = n: builtins.pathExists (pathToOverlay n + "/default.nix");
|
||||||
|
isOverlay = n: isNixDir n || isNixFile n;
|
||||||
|
overlays = builtins.filter isOverlay candidates;
|
||||||
|
importOverlay = n: import (pathToOverlay n);
|
||||||
|
in map importOverlay overlays
|
|
@ -1,6 +0,0 @@
|
||||||
self: super:
|
|
||||||
if super.config.allowUnfree or false then
|
|
||||||
{ }
|
|
||||||
else {
|
|
||||||
unfree = import <nixpkgs> { config.allowUnfree = true; };
|
|
||||||
}
|
|
|
@ -2,7 +2,7 @@ self: super:
|
||||||
let
|
let
|
||||||
preview = version: func:
|
preview = version: func:
|
||||||
if super.lib.versionOlder super.lib.version version then
|
if super.lib.versionOlder super.lib.version version then
|
||||||
func (import <unstable> { })
|
func (import self.sources.unstable { })
|
||||||
else
|
else
|
||||||
{ };
|
{ };
|
||||||
in preview "20.09pre-git" (unstable: {
|
in preview "20.09pre-git" (unstable: {
|
6
overlays/20-unfree.nix
Normal file
6
overlays/20-unfree.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
self: super:
|
||||||
|
if super.config.allowUnfree or false then
|
||||||
|
{ }
|
||||||
|
else {
|
||||||
|
unfree = import self.sources.nixpkgs { config.allowUnfree = true; };
|
||||||
|
}
|
1
overlays/grafana-devel/default.nix
Normal file
1
overlays/grafana-devel/default.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
self: super: { grafana-devel = self.callPackage ./package.nix { }; }
|
|
@ -12,7 +12,7 @@ let
|
||||||
providers = [{
|
providers = [{
|
||||||
name = "Static dashboards";
|
name = "Static dashboards";
|
||||||
folder = "";
|
folder = "";
|
||||||
options.path = ../system/monitoring/grafana-dashboards;
|
options.path = ../../system/monitoring/grafana-dashboards;
|
||||||
orgId = 1;
|
orgId = 1;
|
||||||
type = "file";
|
type = "file";
|
||||||
updateIntervalSeconds = 60;
|
updateIntervalSeconds = 60;
|
52
overlays/pkgSets.nix
Normal file
52
overlays/pkgSets.nix
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
self: super: {
|
||||||
|
# pkgs assumed to be present on a non nixos host
|
||||||
|
core-system-pkgs = {
|
||||||
|
inherit (self)
|
||||||
|
gitFull gnumake mkpasswd file wget curl wireguard gnupg mutt bind liboping
|
||||||
|
psmisc unzip rename whois lsof parted python3 binutils ntfsprogs neovim;
|
||||||
|
};
|
||||||
|
|
||||||
|
extra-system-pkgs = {
|
||||||
|
inherit (self.python3Packages) qrcode;
|
||||||
|
inherit (self)
|
||||||
|
git-crypt htop tree pwgen borgbackup inotifyTools direnv socat nmap ncdu
|
||||||
|
tcpdump tmux tig exa fzf ag fd bat ripgrep ranger pass sshuttle vnstat
|
||||||
|
entr libargon2 mblaze niv;
|
||||||
|
};
|
||||||
|
|
||||||
|
my-home-pkgs = {
|
||||||
|
print215 = self.writeShellScriptBin "print215" ''
|
||||||
|
scp "$@" ag-forward:
|
||||||
|
ssh ag-forward lpr -Zduplex -r "$@"
|
||||||
|
'';
|
||||||
|
print215single = self.writeShellScriptBin "print215single" ''
|
||||||
|
scp "$@" ag-forward:
|
||||||
|
ssh ag-forward lpr -r "$@"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
desktop-pkgs = {
|
||||||
|
inherit (self) lm_sensors xwayland xdg_utils libnotify;
|
||||||
|
inherit (self.gnomeExtensions) appindicator system-monitor;
|
||||||
|
inherit (self.gnome3)
|
||||||
|
dconf dconf-editor gnome-tweaks gnome-shell-extensions adwaita-icon-theme
|
||||||
|
gnome-session;
|
||||||
|
};
|
||||||
|
home-pkgs = {
|
||||||
|
inherit (self.pythonPackages) yapf jsbeautifier;
|
||||||
|
inherit (self.haskellPackages) brittany ormolu releaser;
|
||||||
|
inherit (self)
|
||||||
|
go gdb mpc_cli ncmpcpp shfmt htmlTidy astyle nodejs tasksh magic-wormhole
|
||||||
|
nixfmt stack ghcid rnix-lsp tmate rustup kitty ghc cabal-install;
|
||||||
|
obelisk = (import self.sources.obelisk { }).command;
|
||||||
|
};
|
||||||
|
accounting-pkgs = {
|
||||||
|
inherit (self.haskellPackages) hledger hledger-ui hledger-web;
|
||||||
|
inherit (self) ledger jali;
|
||||||
|
};
|
||||||
|
system-pkgs = self.core-system-pkgs // self.extra-system-pkgs // {
|
||||||
|
inherit (self) test-system-config test-home-config test-config;
|
||||||
|
home-manager =
|
||||||
|
self.callPackage "${self.sources.home-manager}/home-manager" { };
|
||||||
|
};
|
||||||
|
foreign-home-pkgs = self.extra-system-pkgs;
|
||||||
|
}
|
|
@ -1,7 +1,12 @@
|
||||||
|
self: super:
|
||||||
let
|
let
|
||||||
inherit (import ../lib)
|
bins = [ self.nix ];
|
||||||
pkgs writeHaskellScript home-manager unstable haskellList;
|
imports = [ "System.IO (hFlush)" ];
|
||||||
in rec {
|
repoSrc = "git@hera.m-0.eu:nixos-config";
|
||||||
|
configPath = "/etc/nixos";
|
||||||
|
systems = [ "apollo" "hera" ];
|
||||||
|
homes = self.lib.attrNames (import ../home/modes.nix);
|
||||||
|
keys = [ "default" "apollo" "hera" ];
|
||||||
haskellBody = name: commandline: ''
|
haskellBody = name: commandline: ''
|
||||||
main = do
|
main = do
|
||||||
(configDir:hostname:args) <- getArgs
|
(configDir:hostname:args) <- getArgs
|
||||||
|
@ -11,10 +16,9 @@ in rec {
|
||||||
${commandline}
|
${commandline}
|
||||||
say [i|Build of ${name} config for #{hostname} was successful.|]
|
say [i|Build of ${name} config for #{hostname} was successful.|]
|
||||||
'';
|
'';
|
||||||
bins = [ pkgs.nix ];
|
in {
|
||||||
imports = [ "System.IO (hFlush)" ];
|
|
||||||
|
|
||||||
test-system-config = writeHaskellScript {
|
test-system-config = self.writeHaskellScript {
|
||||||
name = "test-system-config";
|
name = "test-system-config";
|
||||||
inherit bins;
|
inherit bins;
|
||||||
inherit imports;
|
inherit imports;
|
||||||
|
@ -22,7 +26,7 @@ in rec {
|
||||||
nix_build $ ["<nixpkgs/nixos>", "-A", "system"] ++ paths ++ ["-I", [i|nixos-config=#{configDir}/hosts/#{hostname}/configuration.nix|], "-o", [i|result-system-#{hostname}|]] ++ fmap toString args
|
nix_build $ ["<nixpkgs/nixos>", "-A", "system"] ++ paths ++ ["-I", [i|nixos-config=#{configDir}/hosts/#{hostname}/configuration.nix|], "-o", [i|result-system-#{hostname}|]] ++ fmap toString args
|
||||||
'');
|
'');
|
||||||
|
|
||||||
test-home-config = writeHaskellScript {
|
test-home-config = self.writeHaskellScript {
|
||||||
name = "test-home-config";
|
name = "test-home-config";
|
||||||
inherit bins;
|
inherit bins;
|
||||||
inherit imports;
|
inherit imports;
|
||||||
|
@ -30,15 +34,10 @@ in rec {
|
||||||
nix_build $ paths ++ [[i|#{configDir}/home/target.nix|], "-A", hostname, "-o", [i|result-home-manager-#{hostname}|]] ++ fmap toString args
|
nix_build $ paths ++ [[i|#{configDir}/home/target.nix|], "-A", hostname, "-o", [i|result-home-manager-#{hostname}|]] ++ fmap toString args
|
||||||
'');
|
'');
|
||||||
|
|
||||||
repoSrc = "git@hera.m-0.eu:nixos-config";
|
test-config = self.writeHaskellScript {
|
||||||
configPath = "/etc/nixos";
|
|
||||||
systems = [ "apollo" "hera" ];
|
|
||||||
homes = pkgs.lib.attrNames (import ../home/modes.nix);
|
|
||||||
keys = [ "default" "apollo" "hera" ];
|
|
||||||
test-config = writeHaskellScript {
|
|
||||||
name = "test-config";
|
name = "test-config";
|
||||||
bins =
|
bins =
|
||||||
[ test-system-config test-home-config pkgs.git pkgs.niv pkgs.git-crypt ];
|
[ self.test-system-config self.test-home-config self.git self.niv self.git-crypt ];
|
||||||
imports = [ "System.Directory (withCurrentDirectory)" ];
|
imports = [ "System.Directory (withCurrentDirectory)" ];
|
||||||
} ''
|
} ''
|
||||||
checkout :: IO FilePath
|
checkout :: IO FilePath
|
||||||
|
@ -52,7 +51,7 @@ in rec {
|
||||||
bracket checkout (rm "-rf") $ \repoDir -> do
|
bracket checkout (rm "-rf") $ \repoDir -> do
|
||||||
withCurrentDirectory repoDir $ do
|
withCurrentDirectory repoDir $ do
|
||||||
mapM_ (\x -> git_crypt "unlock" ([i|${configPath}/.git/git-crypt/keys/#{x}|] :: String)) ${
|
mapM_ (\x -> git_crypt "unlock" ([i|${configPath}/.git/git-crypt/keys/#{x}|] :: String)) ${
|
||||||
haskellList keys
|
self.haskellList keys
|
||||||
}
|
}
|
||||||
when bump $ ignoreFailure $ niv "update"
|
when bump $ ignoreFailure $ niv "update"
|
||||||
changed <- (mempty /=) <$> (git "-C" repoDir "status" "--porcelain" |> captureTrim)
|
changed <- (mempty /=) <$> (git "-C" repoDir "status" "--porcelain" |> captureTrim)
|
||||||
|
@ -61,8 +60,8 @@ in rec {
|
||||||
git "-C" repoDir "config" "user.name" "maralorn (nix-auto-updater)"
|
git "-C" repoDir "config" "user.name" "maralorn (nix-auto-updater)"
|
||||||
git "-C" repoDir "commit" "-am" "Update dependencies with niv"
|
git "-C" repoDir "commit" "-am" "Update dependencies with niv"
|
||||||
git "-C" repoDir "push" "-f" "origin" "master:version-bump"
|
git "-C" repoDir "push" "-f" "origin" "master:version-bump"
|
||||||
mapM_ (test_system_config repoDir) ${haskellList systems}
|
mapM_ (test_system_config repoDir) ${self.haskellList systems}
|
||||||
mapM_ (test_home_config repoDir) ${haskellList homes}
|
mapM_ (test_home_config repoDir) ${self.haskellList homes}
|
||||||
when changed $ do
|
when changed $ do
|
||||||
git "-C" repoDir "push" "origin" "master:master"
|
git "-C" repoDir "push" "origin" "master:master"
|
||||||
'';
|
'';
|
74
overlays/writeHaskellScript.nix
Normal file
74
overlays/writeHaskellScript.nix
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
self: super: {
|
||||||
|
haskellList = list: ''["${builtins.concatStringsSep ''", "'' list}"]'';
|
||||||
|
writeHaskellScript =
|
||||||
|
{ name ? "haskell-script", bins ? [ ], libraries ? [ ], imports ? [ ] }:
|
||||||
|
code:
|
||||||
|
self.writers.makeBinWriter {
|
||||||
|
compileScript = ''
|
||||||
|
cp $contentPath ${name}.hs
|
||||||
|
${
|
||||||
|
self.ghc.withPackages (_:
|
||||||
|
libraries ++ (builtins.attrValues {
|
||||||
|
inherit (self.haskellPackages)
|
||||||
|
shh string-interpolate relude async say cmdargs text;
|
||||||
|
}))
|
||||||
|
}/bin/ghc ${name}.hs -threaded -Wall -Wno-unused-top-binds -Wno-missing-signatures -Wno-type-defaults -Wno-unused-imports -Werror
|
||||||
|
mv ${name} $out
|
||||||
|
${self.binutils-unwrapped}/bin/strip --strip-unneeded "$out"
|
||||||
|
'';
|
||||||
|
} "/bin/${name}" ''
|
||||||
|
{-# LANGUAGE DeriveDataTypeable #-}
|
||||||
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE ExtendedDefaultRules #-}
|
||||||
|
{-# LANGUAGE MultiWayIf #-}
|
||||||
|
{-# LANGUAGE LambdaCase #-}
|
||||||
|
{-# LANGUAGE ViewPatterns #-}
|
||||||
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
|
{-# LANGUAGE NoImplicitPrelude #-}
|
||||||
|
{-# LANGUAGE TupleSections #-}
|
||||||
|
|
||||||
|
import Shh
|
||||||
|
import Relude
|
||||||
|
import Say
|
||||||
|
import qualified Relude.Unsafe as Unsafe
|
||||||
|
import qualified Data.ByteString.Lazy as LBS
|
||||||
|
import qualified Data.ByteString as BS
|
||||||
|
import qualified Data.Text as Text
|
||||||
|
import System.Environment (getArgs)
|
||||||
|
import Control.Exception (bracket, try)
|
||||||
|
import Data.String.Interpolate (i)
|
||||||
|
import Control.Concurrent.Async
|
||||||
|
${builtins.concatStringsSep "\n" (map (x: "import ${x}") imports)}
|
||||||
|
|
||||||
|
-- Load binaries from Nix packages. The dependencies will be captured
|
||||||
|
-- in the closure.
|
||||||
|
loadFromBins (${
|
||||||
|
self.haskellList
|
||||||
|
(builtins.map toString (bins ++ [ self.coreutils self.nix ]))
|
||||||
|
} :: [String])
|
||||||
|
|
||||||
|
getNivPath :: Text -> Text -> IO Text
|
||||||
|
getNivPath sources channel = do
|
||||||
|
let expression = [i|(import #{sources}/nix/sources.nix).#{channel}|] :: String
|
||||||
|
nix_build ["-Q", "-E", expression, "--no-out-link"] &> devNull
|
||||||
|
escaped <- nix_instantiate ["--eval" :: String, "-E", [i|toString #{expression}|]] |> captureTrim
|
||||||
|
pure . Text.dropAround ('"' ==) . decodeUtf8 . trim $ escaped
|
||||||
|
|
||||||
|
myNixPath :: Text -> IO [String]
|
||||||
|
myNixPath path = concat <$> mapM getNivAssign ["home-manager", "nixpkgs", "unstable"]
|
||||||
|
where
|
||||||
|
tag name str = ["-I", [i|#{name :: Text}=#{str :: Text}|]] :: [String]
|
||||||
|
getNivAssign name = tag name <$> getNivPath path name
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
${code}
|
||||||
|
'';
|
||||||
|
get-niv-path = self.writeHaskellScript { name = "get-niv-path"; } ''
|
||||||
|
main = do
|
||||||
|
[sources, channel] <- fmap toText <$> getArgs
|
||||||
|
path <- getNivPath sources channel
|
||||||
|
say path
|
||||||
|
'';
|
||||||
|
}
|
|
@ -1,58 +0,0 @@
|
||||||
let
|
|
||||||
my-lib = import ../lib;
|
|
||||||
inherit (my-lib) pkgs;
|
|
||||||
in rec {
|
|
||||||
obelisk = (import pkgs.sources.obelisk { }).command;
|
|
||||||
nix-direnv = pkgs.sources.nix-direnv + "/direnvrc";
|
|
||||||
|
|
||||||
# pkgs assumed to be present on a non nixos host
|
|
||||||
core-system-pkgs = {
|
|
||||||
inherit (pkgs)
|
|
||||||
gitFull gnumake mkpasswd file wget curl wireguard gnupg mutt bind liboping
|
|
||||||
psmisc unzip rename whois lsof parted python3 binutils ntfsprogs neovim;
|
|
||||||
};
|
|
||||||
|
|
||||||
extra-system-pkgs = {
|
|
||||||
inherit (pkgs.python3Packages) qrcode;
|
|
||||||
inherit (pkgs)
|
|
||||||
git-crypt htop tree pwgen borgbackup inotifyTools direnv socat nmap ncdu
|
|
||||||
tcpdump tmux tig exa fzf ag fd bat ripgrep ranger pass sshuttle vnstat
|
|
||||||
entr libargon2 mblaze niv;
|
|
||||||
};
|
|
||||||
|
|
||||||
my-home-pkgs = {
|
|
||||||
print215 = pkgs.writeShellScriptBin "print215" ''
|
|
||||||
scp "$@" ag-forward:
|
|
||||||
ssh ag-forward lpr -Zduplex -r "$@"
|
|
||||||
'';
|
|
||||||
print215single = pkgs.writeShellScriptBin "print215single" ''
|
|
||||||
scp "$@" ag-forward:
|
|
||||||
ssh ag-forward lpr -r "$@"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
desktop-pkgs = {
|
|
||||||
inherit (pkgs) lm_sensors xwayland xdg_utils libnotify;
|
|
||||||
inherit (pkgs.gnomeExtensions) appindicator system-monitor;
|
|
||||||
inherit (pkgs.gnome3)
|
|
||||||
dconf dconf-editor gnome-tweaks gnome-shell-extensions adwaita-icon-theme
|
|
||||||
gnome-session;
|
|
||||||
};
|
|
||||||
home-pkgs = {
|
|
||||||
inherit (pkgs.pythonPackages) yapf jsbeautifier;
|
|
||||||
inherit (pkgs.haskellPackages) brittany ormolu releaser;
|
|
||||||
inherit (pkgs)
|
|
||||||
go gdb mpc_cli ncmpcpp shfmt htmlTidy astyle nodejs tasksh magic-wormhole
|
|
||||||
nixfmt stack ghcid rnix-lsp tmate rustup kitty ghc cabal-install;
|
|
||||||
inherit obelisk;
|
|
||||||
};
|
|
||||||
accounting-pkgs = {
|
|
||||||
inherit (pkgs.haskellPackages) hledger hledger-ui hledger-web;
|
|
||||||
inherit (pkgs) ledger jali;
|
|
||||||
};
|
|
||||||
system-pkgs = core-system-pkgs // extra-system-pkgs // {
|
|
||||||
inherit (import ../lib/test.nix)
|
|
||||||
test-system-config test-home-config test-config;
|
|
||||||
inherit (my-lib) home-manager;
|
|
||||||
};
|
|
||||||
foreign-home-pkgs = extra-system-pkgs;
|
|
||||||
}
|
|
|
@ -11,11 +11,7 @@ in {
|
||||||
i18n = { defaultLocale = "en_US.UTF-8"; };
|
i18n = { defaultLocale = "en_US.UTF-8"; };
|
||||||
|
|
||||||
# For nixos-rebuild
|
# For nixos-rebuild
|
||||||
nixpkgs.overlays = let overlayPath = ../overlays;
|
nixpkgs.overlays = import ../overlays.nix { inherit lib; };
|
||||||
in map (n: import (overlayPath + ("/" + n))) (builtins.filter (n:
|
|
||||||
builtins.match ".*\\.nix" n != null
|
|
||||||
|| builtins.pathExists (overlayPath + ("/" + n + "/default.nix")))
|
|
||||||
(lib.attrNames (builtins.readDir overlayPath)));
|
|
||||||
|
|
||||||
time.timeZone = "Europe/Berlin";
|
time.timeZone = "Europe/Berlin";
|
||||||
|
|
||||||
|
@ -53,7 +49,7 @@ in {
|
||||||
[ "https://cache.nixos.org/" "https://nixcache.reflex-frp.org" ];
|
[ "https://cache.nixos.org/" "https://nixcache.reflex-frp.org" ];
|
||||||
binaryCachePublicKeys =
|
binaryCachePublicKeys =
|
||||||
[ "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=" ];
|
[ "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=" ];
|
||||||
nixPath = [ "/etc/nix-path" "nixpkgs-overlays=/etc/nixos/overlays" ];
|
nixPath = [ "/etc/nix-path" ];
|
||||||
extraOptions = ''
|
extraOptions = ''
|
||||||
fallback = true
|
fallback = true
|
||||||
keep-outputs = true
|
keep-outputs = true
|
||||||
|
|
|
@ -26,10 +26,12 @@
|
||||||
environment = {
|
environment = {
|
||||||
# Put these into an extra file so the essential packages can also be included on non selfadminstrated systems from home-manager
|
# Put these into an extra file so the essential packages can also be included on non selfadminstrated systems from home-manager
|
||||||
systemPackages = builtins.attrValues ({
|
systemPackages = builtins.attrValues ({
|
||||||
inherit (import ../../lib/update-system.nix
|
inherit (import ../../lib/update-system.nix {
|
||||||
config.system.build.nixos-rebuild)
|
inherit pkgs;
|
||||||
|
nixos-rebuild = config.system.build.nixos-rebuild;
|
||||||
|
})
|
||||||
update-system;
|
update-system;
|
||||||
} // (import ../../pkgs).system-pkgs);
|
} // pkgs.system-pkgs);
|
||||||
};
|
};
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
|
|
Loading…
Reference in a new issue