flakfiy some Justfile recipes and experiment with wayland based custom desktop

This commit is contained in:
steveej 2023-05-21 11:58:57 +02:00
parent 06a47c0d23
commit 476e10780b
18 changed files with 739 additions and 149 deletions

View file

@ -1,18 +1,12 @@
_DEFAULT_VERSION_TMPL:
echo "{{invocation_directory()}}/nix/variables/versions.tmpl.nix"
_DEFAULT_VERSION:
echo "{{invocation_directory()}}/nix/variables/versions.nix"
_usage:
just -l
# Re-render the default versions
update-default-versions:
#!/usr/bin/env bash
template="$(just _DEFAULT_VERSION_TMPL)"
outfile="$(just _DEFAULT_VERSION)"
esh -o ${outfile} ${template}
nix flake update
_get_nix_path versionsPath:
echo $(set -x; nix-build --no-link --show-trace {{invocation_directory()}}/nix/default.nix -A channelSources --argstr versionsPath {{versionsPath}})
@ -34,55 +28,14 @@ _render_templates:
# nix/scripts/pre-eval-fixed.sh nix/home-manager/profiles/dotfiles/vcsh{.tmpl,}.nix
fi
_rebuild-device dir rebuildarg="dry-activate" +moreargs="": _render_templates
#!/usr/bin/env bash
set -ex
just -v _device rebuild {{dir}} --argstr rebuildarg {{rebuildarg}} {{moreargs}}
rebuild-remote-device device target rebuildarg="dry-activate" :
#!/usr/bin/env bash
set -ex
just -v _rebuild-device nix/os/devices/{{device}} {{rebuildarg}} --argstr moreargs "'--target-host\ {{target}}'"
# Rebuild this device's NixOS
rebuild-this-device rebuildarg="dry-activate":
#!/usr/bin/env bash
set -e
function parse_hm_rebuildarg() {
case $1 in
switch)
echo switch
;;
*)
echo build
;;
esac
}
export SYSREBUILD_LOG=.$(hostname -s)_sysrebuild.log
export HOMEREBUILD_LOG=.$(hostname -s)_homerebuild.log
echo Rebuilding system in {{rebuildarg}}-mode...
if just -v _rebuild-device nix/os/devices/$(hostname -s) {{rebuildarg}} > ${SYSREBUILD_LOG} 2>&1 ; then
echo System rebuild successful
else
cat ${SYSREBUILD_LOG}
echo ERROR: system rebuild failed
exit 1
fi
if type home-manager > /dev/null 2>&1; then
echo Rebuilding home in $(parse_hm_rebuildarg {{rebuildarg}})-mode...
source $(just -v _get_nix_path {{invocation_directory()}}/nix/os/devices/$(hostname -s)/versions.nix)
if home-manager -v $(parse_hm_rebuildarg {{rebuildarg}}) > ${HOMEREBUILD_LOG} 2>&1 ; then
echo Home rebuild successful
else
cat ${HOMEREBUILD_LOG}
echo ERROR: home rebuild failed
exit 1
fi
fi
rebuild-this-device +rebuildargs="dry-activate":
nix run .#colmena -- apply --on $(hostname -s) {{rebuildargs}}
# Re-render the versions of a remote device and rebuild its environment
update-remote-device devicename target rebuildmode='switch':
@ -119,31 +72,15 @@ update-this-device rebuild-mode='switch':
#!/usr/bin/env bash
set -e
template=nix/os/devices/$(hostname -s)/versions.tmpl.nix
outfile=nix/os/devices/$(hostname -s)/versions.nix
(
set -xe
cd nix/os/devices/$(hostname -s)
nix flake update
)
if ! test -e ${template}; then
template="$(just _DEFAULT_VERSION_TMPL)"
fi
just -v rebuild-this-device {{rebuild-mode}}
esh -o ${outfile} ${template}
if ! test "$(git diff ${outfile})"; then
echo Already on latest versions
exit 0
fi
export SYSREBUILD_LOG=.$(hostname -s)_sysrebuild.log
just -v rebuild-this-device dry-activate || {
echo ERROR: Update failed, reverting ${outfile}...
exit 1
}
just -v rebuild-this-device {{rebuild-mode}} || {
echo ERROR: Rebuilding in {{rebuild-mode}}-mode failed
exit 1
}
git commit -v ${outfile} -m "nix/os/devices/$(hostname -s): bump versions"
git commit -v nix/os/devices/$(hostname -s)/flake.{nix,lock} -m "nix/os/devices/$(hostname -s): bump versions"
# Rebuild an offline system
rebuild-disk device:

239
flake.lock generated
View file

@ -1,5 +1,22 @@
{
"nodes": {
"aphorme_launcher": {
"flake": false,
"locked": {
"lastModified": 1682579667,
"narHash": "sha256-TTGneJdTpHoDA2rZczKQ77+XByZGBz/NRqY21AMP+BQ=",
"owner": "Iaphetes",
"repo": "aphorme_launcher",
"rev": "182077d5b438301f9a8522649605dc1b736d9677",
"type": "github"
},
"original": {
"owner": "Iaphetes",
"ref": "main",
"repo": "aphorme_launcher",
"type": "github"
}
},
"colmena": {
"inputs": {
"flake-compat": "flake-compat",
@ -10,11 +27,11 @@
"stable": "stable"
},
"locked": {
"lastModified": 1675730932,
"narHash": "sha256-XcmirehPIcZGS7PzkS3WvAYQ9GBlBvCxYToIOIV2PVE=",
"lastModified": 1682202576,
"narHash": "sha256-vcTEEEHKx4PTfY80bUmZMwXRy0cTDJCkULHhqe1HJS8=",
"owner": "zhaofengli",
"repo": "colmena",
"rev": "e034c15825c439131e4489de5a82cf8e5398fa61",
"rev": "089431737e283ed3e402a7dff578cb442444c431",
"type": "github"
},
"original": {
@ -23,6 +40,29 @@
"type": "github"
}
},
"crane": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1681680516,
"narHash": "sha256-EB8Adaeg4zgcYDJn9sR6UMjN/OHdIiMMK19+3LmmXQY=",
"owner": "ipetkov",
"repo": "crane",
"rev": "54b63c8eae4c50172cb50b612946ff1d2bc1c75c",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"disko": {
"inputs": {
"nixpkgs": [
@ -45,6 +85,27 @@
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1682576562,
"narHash": "sha256-JsSF/hf/i/2IURKXt6tt58o6/JFk2RvCMxGbUHRd97M=",
"owner": "nix-community",
"repo": "fenix",
"rev": "e5fcb848257ba1c4f4f0615bfadaeddf0f851ad5",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@ -61,6 +122,22 @@
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
@ -115,6 +192,36 @@
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1678901627,
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"get-flake": {
"locked": {
"lastModified": 1673819588,
@ -130,6 +237,38 @@
"type": "github"
}
},
"jay": {
"flake": false,
"locked": {
"lastModified": 1683988763,
"narHash": "sha256-vaHNBwCIMNf/rnnievmxhF5wxci0Rbu2IUXiUxxKF74=",
"owner": "mahkoh",
"repo": "jay",
"rev": "80dc8770c51c0409a32b212499e0803dd585cab1",
"type": "github"
},
"original": {
"owner": "mahkoh",
"repo": "jay",
"type": "github"
}
},
"magmawm": {
"flake": false,
"locked": {
"lastModified": 1684598861,
"narHash": "sha256-yya0fLFie9RjZ+97dcwIFidAApX2XpVn9GokzTnUlyE=",
"owner": "MagmaWM",
"repo": "MagmaWM",
"rev": "c8dc4bac3b5acf870c28896de333033eedc80397",
"type": "github"
},
"original": {
"owner": "MagmaWM",
"repo": "MagmaWM",
"type": "github"
}
},
"nixos-2211": {
"locked": {
"lastModified": 1674463419,
@ -208,11 +347,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1681696129,
"narHash": "sha256-Ba2y1lmsWmmAOAoTD5G9UnTS/UqV0ZFyzysgdfu7qag=",
"lastModified": 1682493015,
"narHash": "sha256-KiMOAe8u83QDF40Z25kWMkZbqr9U+mvjvEJy5Qvw0nw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "de66115c552acc4e0c0f92c5a5efb32e37dfa216",
"rev": "60c0f762658916a4a5b5a36b3e06486f8301daf4",
"type": "github"
},
"original": {
@ -240,13 +379,78 @@
"type": "github"
}
},
"ofi-pass": {
"flake": false,
"locked": {
"lastModified": 1627767117,
"narHash": "sha256-JUXW1M4sYWL1Mahy4AXgNzIUM+3T0nshnoKPwBzAkis=",
"owner": "sereinity",
"repo": "ofi-pass",
"rev": "6dc6938b0d45f05e307539c6c5a4609427a2747c",
"type": "github"
},
"original": {
"owner": "sereinity",
"repo": "ofi-pass",
"type": "github"
}
},
"root": {
"inputs": {
"aphorme_launcher": "aphorme_launcher",
"colmena": "colmena",
"crane": "crane",
"fenix": "fenix",
"flake-parts": "flake-parts",
"get-flake": "get-flake",
"jay": "jay",
"magmawm": "magmawm",
"nixos-anywhere": "nixos-anywhere",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"ofi-pass": "ofi-pass",
"yofi": "yofi"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1682502267,
"narHash": "sha256-S1Rk8+lW6GqnfVDyxR7ctJaGRglvhm/DWCeDD3J3ut8=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "797c2f1dde0905afa24f567160ed23ba2bc79a81",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": [
"crane",
"flake-utils"
],
"nixpkgs": [
"crane",
"nixpkgs"
]
},
"locked": {
"lastModified": 1680488274,
"narHash": "sha256-0vYMrZDdokVmPQQXtFpnqA2wEgCCUXf5a3dDuDVshn0=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "7ec2ff598a172c6e8584457167575b3a1a5d80d8",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"stable": {
@ -279,6 +483,27 @@
"repo": "treefmt-nix",
"type": "github"
}
},
"yofi": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1678976029,
"narHash": "sha256-AZ2+FQtVwUFgv4kiZqMKmiXS2qygMktDE185O19BXiM=",
"owner": "l4l",
"repo": "yofi",
"rev": "811a4358913aed527348f9584d6c0767983299bb",
"type": "github"
},
"original": {
"owner": "l4l",
"repo": "yofi",
"type": "github"
}
}
},
"root": "root",

View file

@ -1,17 +1,53 @@
# flake.nix
{
inputs = {
# flake and infra basics
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
flake-parts.url = "github:hercules-ci/flake-parts";
get-flake.url = "github:ursi/get-flake";
colmena.url = "github:zhaofengli/colmena";
colmena.inputs.nixpkgs.follows = "nixpkgs";
nixos-anywhere.url = github:numtide/nixos-anywhere/main;
nixos-anywhere.inputs.nixpkgs.follows = "nixpkgs";
colmena = {
url = "github:zhaofengli/colmena";
inputs.nixpkgs.follows = "nixpkgs";
};
# libraries for building applications
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
# applications
aphorme_launcher = {
url = "github:Iaphetes/aphorme_launcher/main";
flake = false;
};
yofi = {
url = "github:l4l/yofi";
flake = true;
inputs.nixpkgs.follows = "nixpkgs";
};
ofi-pass = {
url = "github:sereinity/ofi-pass";
flake = false;
};
jay = {
url = "github:mahkoh/jay";
flake = false;
};
magmawm = {
url = "github:MagmaWM/MagmaWM";
flake = false;
};
};
outputs = inputs @ {
@ -58,20 +94,56 @@
lib,
pkgs,
...
}: {
}: rec {
imports = [
./nix/modules/flake-parts/perSystem/default.nix
];
packages = let
dcpj4110dw = pkgs.callPackage (self + /nix/pkgs/dcpj4110dw) {};
craneLib =
inputs.crane.lib.${system}.overrideToolchain
inputs'.fenix.packages.stable.toolchain;
craneLibOfiPass =
inputs.crane.lib.${system}.overrideToolchain
(
inputs'.fenix.packages.stable.toolchain
# .override {
# date = "1.60.0";
# }
);
in {
dcpj4110dwDriver = dcpj4110dw.driver;
dcpj4110dwCupswrapper = dcpj4110dw.cupswrapper;
aphorme_launcher = craneLib.buildPackage {src = inputs.aphorme_launcher;};
yofi = inputs'.yofi.packages.default;
ofi-pass = craneLibOfiPass.buildPackage {src = inputs.ofi-pass;};
inherit (inputs'.colmena.packages) colmena;
jay = pkgs.callPackage (self + /nix/pkgs/jay.nix) {
src = inputs.jay;
rustPlatform = pkgs.makeRustPlatform {
cargo = inputs'.fenix.packages.stable.toolchain;
rustc = inputs'.fenix.packages.stable.toolchain;
};
};
magmawm = pkgs.callPackage (self + /nix/pkgs/magmawm.nix) {
inherit craneLib;
src = inputs.magmawm;
};
};
formatter = pkgs.alejandra;
devShells.default = import ./nix/devShells.nix {inherit inputs' pkgs;};
devShells.default = import ./nix/devShells.nix {
inherit inputs' pkgs;
packages' = packages;
};
};
};
}

View file

@ -1,5 +1,6 @@
{
inputs',
packages',
pkgs,
}:
pkgs.stdenv.mkDerivation {
@ -27,6 +28,14 @@ pkgs.stdenv.mkDerivation {
git
ripgrep
lm_sensors
pass
prs
fuzzel
wofi
# broken as of 2023-04-27 because it doesn't load without a config
# packages'.aphorme_launcher
packages'.yofi
# packages'.ofi-pass
apacheHttpd

View file

@ -16,9 +16,12 @@ in {
# FIXME: fix homeshick when no WAN connection is available
# ../programs/homeshick.nix
# ../profiles/gnome-desktop.nix
../profiles/sway-desktop.nix
../profiles/experimental-desktop.ni
../programs/redshift.nix
../programs/espanso.nix
../programs/gnome-desktop.nix
../programs/gpg-agent.nix
../programs/radicale.nix
@ -30,14 +33,21 @@ in {
../programs/neovim.nix
../programs/pass.nix
../programs/vscode
../programs/holochain-launcher.nix
];
home.sessionVariables.HM_CONFIG = "graphical-fullblown";
home.sessionVariables.GOPATH = "$HOME/src/go";
home.sessionVariables.PATH = pkgs.lib.concatStringsSep ":" ["$HOME/.local/bin" "$PATH"];
# workaround: usually created by 'home.xsession.enabled=true' and i don't use with gnome
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = ["graphical-session-pre.target"];
};
};
home.packages =
[]
++ (with pkgs; [
@ -91,12 +101,14 @@ in {
# Messaging/Communication
signal-desktop
pidgin
pkgsUnstable.session-desktop
# pidgin
hexchat
schildichat-desktop
aspellDicts.en
aspellDicts.de
skypeforlinux
pkgsUnstable.jitsi-meet-electron
# skypeforlinux
# pkgsUnstable.jitsi-meet-electron
thunderbird
evolution # gnome4.glib_networking
kotatogram-desktop
@ -168,6 +180,7 @@ in {
# Document Processing and Management
mendeley
evince
(pkgsUnstable.logseq.override (_: {electron = pkgs.electron_20;}))
# File Synchronzation

View file

@ -0,0 +1,28 @@
{
pkgs,
config,
lib,
nodeFlake,
packages',
...
}: let
pkgsUnstable = pkgs.callPackage nodeFlake.inputs.nixpkgs-unstable.outPath {};
in {
imports = [
../profiles/wayland-desktop.nix
];
home.packages = with pkgs; [
# experimental WMs
packages'.jay
packages'.magmawm
# swayidle
# swaylock
# # fonts
# noto-fonts
# font-awesome
# noto-fonts-emoji
];
}

View file

@ -5,6 +5,10 @@
...
}: let
in {
imports = [
../profiles/wayland-desktop.nix
];
services = {
gnome-keyring.enable = false;
blueman-applet.enable = true;
@ -20,20 +24,6 @@ in {
services.gpg-agent.pinentryFlavor = "gnome3";
# workaround: usually created by 'home.xsession.enabled=true' and i don't use with gnome
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = ["graphical-session-pre.target"];
};
};
home.packages = [
pkgs.wmctrl
];
home.sessionVariables.MOZ_ENABLE_WAYLAND = "1";
dconf.settings = let
manualKeybindings = [
{
@ -76,12 +66,17 @@ in {
};
# disable the builtin <Super>[1-9] functionality
"org/gnome/shell/keybindings" = builtins.listToAttrs (builtins.genList
"org/gnome/shell/keybindings" = builtins.listToAttrs ((builtins.genList
(i: {
name = "switch-to-application-${toString (i + 1)}";
value = [];
})
numWorkspaces);
numWorkspaces) ++ [
{
name = "toggle-overview";
value = [];
}
]);
# remap it to switching to the workspaces
"org/gnome/desktop/wm/keybindings" = builtins.listToAttrs (builtins.genList

View file

@ -0,0 +1,84 @@
{
pkgs,
config,
lib,
...
}: let
inherit (import ../lib.nix {}) mkSimpleTrayService;
in {
imports = [
../profiles/wayland-desktop.nix
];
home.packages = with pkgs; [
swayidle
swaylock
# fonts
noto-fonts
font-awesome
noto-fonts-emoji
];
wayland.windowManager.sway = {
enable = true;
systemdIntegration = true;
config = let
modifier = "Mod4";
in {
inherit modifier;
keybindings = lib.mkOptionDefault {
"${modifier}+Ctrl+l" = "exec ${pkgs.swaylock}/bin/swaylock -fF";
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
};
terminal = "alacritty";
startup = [
# Launch Firefox on start
# {command = "firefox";}
# {command = "gnome-keyring --replace"}
];
fonts = {
names = [ "Noto Sans" "Font Awesome 5 Free" ];
style = "Heavy";
size = 10.0;
};
#fonts = {
# names = [ "DejaVu Sans Mono" "FontAwesome5Free" ];
# style = "Bold Semi-Condensed";
# size = 11.0;
#};
colors.focused = {
childBorder = "#ffa500";
# border = "#ffa500";
# TODO: refer to the defaults for these
border = "#4c7899";
background = "#285577";
text = "#ffffff";
indicator = "#2e9ef4";
};
window = {
border = 4;
};
};
};
services.swayidle = {
enable = true;
timeouts = [
{ timeout = 60 * 5; command = "${pkgs.swaylock}/bin/swaylock -fF"; }
];
};
}

View file

@ -0,0 +1,43 @@
{
pkgs,
config,
...
}: let
inherit (import ../lib.nix {}) mkSimpleTrayService;
in {
services.gpg-agent.pinentryFlavor = "gtk2";
fonts.fontconfig.enable = true;
home.packages = with pkgs; [
wlr-randr
wayout
wl-clipboard
wmctrl
# identifies key input syms
wev
# TODO: whwat's this for?
# wltype
pavucontrol
playerctl
pasystray
qt5.qtwayland
qt6.qtwayland
];
home.sessionVariables = {
XDG_SESSION_TYPE = "wayland";
NIXOS_OZONE_WL = "1";
MOZ_ENABLE_WAYLAND = "1";
};
home.pointerCursor = {
name = "Vanilla-DMZ";
package = pkgs.vanilla-dmz;
size = 32;
x11.enable = true;
gtk.enable = true;
};
}

View file

@ -1,3 +0,0 @@
{pkgs, ...}: {
home.packages = [pkgs.holochain-launcher];
}

View file

@ -5,5 +5,13 @@
programs.browserpass.enable = true;
home.packages = with pkgs; [pass rofi-pass gnupg];
home.packages = with pkgs; [
gnupg
pass
# broken on wayland
# rofi-pass
prs
];
}

View file

@ -32,7 +32,12 @@
old.propagatedBuildInputs
++ [radicale-storage-decsync];
});
radicale-config = pkgs.writeText "radicale-config" ''
mkRadicaleService = { suffix, port }: let
radicale-config = pkgs.writeText "radicale-config-${suffix}" ''
[server]
hosts = localhost:${builtins.toString(port)}
[auth]
type = htpasswd
htpasswd_filename = ${
@ -44,16 +49,20 @@
[storage]
type = radicale_storage_decsync
filesystem_folder = ${config.xdg.dataHome}/radicale
decsync_dir = ${config.xdg.dataHome}/decsync
filesystem_folder = ${config.xdg.dataHome}/radicale-${suffix}
decsync_dir = ${config.xdg.dataHome}/decsync-${suffix}
'';
in {
systemd.user.services.radicale = {
Unit.Description = "Radicale with DecSync";
systemd.user.services."radicale-${suffix}" = {
Unit.Description = "Radicale with DecSync (${suffix})";
Service = {
ExecStart = "${radicale-decsync}/bin/radicale -C ${radicale-config}";
Restart = "on-failure";
};
Install.WantedBy = ["default.target"];
};
}
};
in builtins.foldl' (sum: cur: lib.recursiveUpdate sum (mkRadicaleService cur)) {} [
{suffix = "personal"; port = 5232;}
{suffix = "family"; port = 5233;}
]

View file

@ -5,7 +5,7 @@
}: let
passwords = import ../../variables/passwords.crypt.nix;
in {
services.redshift = {
services.gammastep = {
enable = true;
inherit (passwords.location.stefan) longitude latitude;
temperature = {
@ -14,10 +14,9 @@ in {
};
tray = true;
settings = {
redshift = {
gammastep = {
brightness-day = 1.0;
brightness-night = 0.5;
adjustment-method = "randr";
};
};
};

View file

@ -1,4 +1,4 @@
{pkgs, ...}: {
{pkgs, lib, ...}: {
home-manager.users.steveej = _: {
imports = [
../../../home-manager/configuration/graphical-fullblown.nix
@ -11,13 +11,86 @@
];
};
services.teamviewer.enable = true;
# TODO: delegate graphical session to home-manager config (mostly)
# FIXME: move this to home-manager entirely
# programs.sway.enable = true;
# programs.sway.package = null;
services.xserver = {
enable = lib.mkForce false;
desktopManager = {
gnome.enable = lib.mkForce false;
xterm.enable = lib.mkForce false;
# FIXME: gnome should be moved to user session
# gnome.enable = true;
# xterm.enable = true;
};
displayManager = {
# gdm.enable = lib.mkForce false;
# FIXME: does the home-manager session have an explicit name?
# defaultSession = "xterm";
# autoLogin = {
# enable = true;
# user = "steveej";
# };
# session = [
# {
# manage = "desktop";
# name = "xsession";
# start = "";
# }
# ];
};
};
services.greetd =
let
# exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l; swaymsg exit"
swayConfig = pkgs.writeText "greetd-sway-config" ''
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
exec "dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK; ${pkgs.greetd.regreet}/bin/regreet; swaymsg exit"
bindsym Mod4+shift+e exec swaynag \
-t warning \
-m 'What do you want to do?' \
-b 'Poweroff' 'systemctl poweroff' \
-b 'Reboot' 'systemctl reboot'
'';
in {
enable = true;
settings = {
vt = 1;
default_session = {
command = "${pkgs.sway}/bin/sway --config ${swayConfig}";
};
};
};
environment.etc."greetd/environments".text = ''
sway
jay
'';
# required by swaywm
security.polkit.enable = true;
security.pam.services.swaylock = { };
services.teamviewer.enable = false;
system.stateVersion = "20.09";
# TODO: move this into home-manager
environment.systemPackages = with pkgs.gnomeExtensions; [
pop-shell
vitals
soft-brightness
# TODO: currently not compatible
# window-switcher-current-workspace-first

View file

@ -31,13 +31,22 @@ in {
];
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [
services.openssh.openFirewall = false;
# TODO: upstream feature for inverse rule to work: `! --in-interface zt+`
networking.firewall.interfaces."eth+".allowedTCPPorts = [
22
# syncthing
22000
# iperf3
5201
];
networking.firewall.interfaces."eth+".allowedUDPPorts = [
# syncthing
22000 21027
];
networking.firewall.logRefusedConnections = false;
networking.usePredictableInterfaceNames = false;
@ -62,7 +71,7 @@ in {
podman = {
enable = true;
dockerCompat = true;
defaultNetwork.dnsname.enable = true;
# defaultNetwork.dnsname.enable = true;
};
};
@ -83,4 +92,11 @@ in {
time.timeZone = lib.mkForce passwords.timeZone.stefan;
hardware.ledger.enable = true;
services.zerotierone = {
enable = true;
joinNetworks = [
"93afae5963c547f1"
];
};
}

View file

@ -62,18 +62,14 @@
displayManager = {
gdm.enable = true;
autoLogin = {
enable = true;
user = "steveej";
};
gdm.wayland = true;
};
};
# gnome, most of it is disabled and ideally it could live entirely in the user's home config
programs.gpaste.enable = false;
programs.gnome-terminal.enable = false;
programs.gnome-documents.enable = false;
# programs.gnome-documents.enable = false;
programs.gnome-disks.enable = false;
services.gnome = {

36
nix/pkgs/jay.nix Normal file
View file

@ -0,0 +1,36 @@
{ lib
, src
, rustPlatform
, libinput
, libxkbcommon
, mesa
, pango
, udev
}:
rustPlatform.buildRustPackage rec {
pname = "jay";
version = src.rev;
inherit src;
cargoLock.lockFile = "${src}/Cargo.lock";
buildInputs = [
libxkbcommon
mesa
pango
udev
libinput
];
RUSTC_BOOTSTRAP = 1;
meta = with lib; {
description = "A Wayland compositor written in Rust";
homepage = "https://github.com/mahkoh/jay";
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = with maintainers; [ dit7ya ];
};
}

50
nix/pkgs/magmawm.nix Normal file
View file

@ -0,0 +1,50 @@
{ lib
, src
, craneLib
, pkg-config
, wayland
, libseat
, libinput
, libxkbcommon
, mesa
, pango
, udev
, dbus
, libGL
}:
craneLib.buildPackage {inherit src;
pname = "magmawm";
version = src.rev;
nativeBuildInputs = [
pkg-config
];
buildInputs = [
wayland
udev
libxkbcommon
libinput
dbus
libseat
mesa
];
preFixup = ''
if [[ -e "$out/bin/magmawm" ]]; then
patchelf \
--add-needed "${libGL}/lib/libEGL.so.1" \
$out/bin/magmawm
fi
'';
meta = with lib; {
description = "A versatile and customizable Window Manager and Wayland Compositor";
homepage = "https://github.com/MagmaWM/MagmaWM";
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = with maintainers; [ ];
};
}