mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +00:00
Compare commits
8 commits
e014507cd4
...
0be59680b4
Author | SHA1 | Date | |
---|---|---|---|
|
0be59680b4 | ||
|
a50b4b1f79 | ||
|
79f1a07fc5 | ||
|
c50222cfe7 | ||
|
0fbf2573cc | ||
|
aa7c7749ed | ||
|
6c8bfaf6e9 | ||
|
e43e174fd4 |
8 changed files with 63 additions and 25 deletions
12
flake.lock
12
flake.lock
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"impermanence": {
|
||||
"locked": {
|
||||
"lastModified": 1708968331,
|
||||
"narHash": "sha256-VUXLaPusCBvwM3zhGbRIJVeYluh2uWuqtj4WirQ1L9Y=",
|
||||
"lastModified": 1717932370,
|
||||
"narHash": "sha256-7C5lCpiWiyPoIACOcu2mukn/1JRtz6HC/1aEMhUdcw0=",
|
||||
"owner": "nix-community",
|
||||
"repo": "impermanence",
|
||||
"rev": "a33ef102a02ce77d3e39c25197664b7a636f9c30",
|
||||
"rev": "27979f1c3a0d3b9617a3563e2839114ba7d48d3f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -17,11 +17,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1716948383,
|
||||
"narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=",
|
||||
"lastModified": 1718160348,
|
||||
"narHash": "sha256-9YrUjdztqi4Gz8n3mBuqvCkMo4ojrA6nASwyIKWMpus=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ad57eef4ef0659193044870c731987a6df5cf56b",
|
||||
"rev": "57d6973abba7ea108bac64ae7629e7431e0199b6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
20
flake.nix
20
flake.nix
|
@ -14,6 +14,20 @@
|
|||
|
||||
forAllSystems = lib.genAttrs [ "x86_64-linux" ];
|
||||
|
||||
pins = {
|
||||
nix.registry.nixpkgs.to = {
|
||||
inherit (nixpkgs) rev;
|
||||
owner = "NixOS";
|
||||
repo = "nixpkgs";
|
||||
type = "github";
|
||||
};
|
||||
nix.registry.bck.to = {
|
||||
owner = "buckley310";
|
||||
repo = "nixos-config";
|
||||
type = "github";
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
formatter = forAllSystems (system:
|
||||
|
@ -33,13 +47,9 @@
|
|||
|
||||
nixosModules =
|
||||
{
|
||||
inherit pins;
|
||||
inherit (impermanence.nixosModules) impermanence;
|
||||
pkgs.nixpkgs.overlays = [ (_: mypkgs) ];
|
||||
pins.nix.registry.bck.to = {
|
||||
owner = "buckley310";
|
||||
repo = "nixos-config";
|
||||
type = "github";
|
||||
};
|
||||
} //
|
||||
self.lib.dirToAttrs ./modules import;
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
|
||||
(writeShellScriptBin "dirt" "while sleep 1; do grep '^Dirty:' /proc/meminfo ; done")
|
||||
|
||||
(writeShellScriptBin "nr" "exec nix repl \"$(nix eval nixpkgs#path)\"")
|
||||
|
||||
(lib.hiPrio (writeShellScriptBin "iftop" ''
|
||||
exec ${iftop}/bin/iftop -P -m100M "$@"
|
||||
''))
|
||||
|
@ -127,6 +125,7 @@
|
|||
set -g history-limit 10000
|
||||
set -g pane-base-index 1
|
||||
set -g renumber-windows on
|
||||
set -g set-titles on
|
||||
set -sa terminal-overrides ",*256color:Tc"
|
||||
# escape-time reduces the time where the escape key acts as an alt key
|
||||
set -s escape-time 1
|
||||
|
@ -163,5 +162,6 @@
|
|||
alias day='date "+%Y-%m-%d"'
|
||||
alias grep='grep --color=auto'
|
||||
alias tmp='cd "$(mktemp -d)"'
|
||||
alias nixpkgs='nix repl --file flake:nixpkgs'
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -30,6 +30,8 @@ let
|
|||
"-jobs $(jobs -pr | wc -l)"
|
||||
];
|
||||
|
||||
termtitle = ''\[\e]0;\u@\h: \w\a\]'';
|
||||
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [
|
||||
|
@ -48,7 +50,7 @@ in
|
|||
local remote=y
|
||||
[ "$XDG_SESSION_TYPE" = "x11" ] && unset remote
|
||||
[ "$XDG_SESSION_TYPE" = "wayland" ] && unset remote
|
||||
PS1="$(powerline-go ${toString args})"
|
||||
PS1="${termtitle}$(powerline-go ${toString args})"
|
||||
}
|
||||
[ "$TERM" = "linux" ] || PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
|
||||
'';
|
||||
|
|
|
@ -18,9 +18,6 @@ with lib;
|
|||
systemd.services.docker.path = [
|
||||
pkgs.openssh
|
||||
];
|
||||
programs.bash.interactiveShellInit = ''
|
||||
((UID)) && alias docker="sudo --preserve-env=SSH_AUTH_SOCK docker"
|
||||
'';
|
||||
virtualisation.docker = {
|
||||
enable = true;
|
||||
enableOnBoot = false;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
extraGroups = [
|
||||
"audio"
|
||||
"dialout"
|
||||
"docker"
|
||||
"input"
|
||||
"networkmanager"
|
||||
"video"
|
||||
|
|
20
modules/swapspace.nix
Normal file
20
modules/swapspace.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.sconfig.swapspace;
|
||||
in
|
||||
{
|
||||
options.sconfig.swapspace = {
|
||||
enable = lib.mkEnableOption "swapspace";
|
||||
swapPath = lib.mkOption { type = lib.types.path; };
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.tmpfiles.rules = [ "d ${cfg.swapPath} 0700 root root" ];
|
||||
systemd.services.swapspace = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Restart = "always";
|
||||
ExecStart = "${pkgs.swapspace}/bin/swapspace --swappath='${cfg.swapPath}'";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -27,16 +27,24 @@ def get_deployment():
|
|||
def expand(ln):
|
||||
hosts = set()
|
||||
for item in ln.split(","):
|
||||
if item == "all":
|
||||
hosts.update(depl)
|
||||
elif item in tags:
|
||||
hosts.update(name for name in depl if item in depl[name]["tags"])
|
||||
if item[0] == "-":
|
||||
item = item[1:]
|
||||
action = hosts.difference_update
|
||||
else:
|
||||
hosts.add(item)
|
||||
action = hosts.update
|
||||
|
||||
if item == "all":
|
||||
action(depl)
|
||||
elif item in tags:
|
||||
action(name for name in depl if item in depl[name]["tags"])
|
||||
else:
|
||||
action([item])
|
||||
|
||||
for host in hosts:
|
||||
for c in host:
|
||||
if not c in (ascii_letters + digits + "-"):
|
||||
raise RuntimeError(f"Invalid hostname: {host}")
|
||||
|
||||
return sorted(hosts)
|
||||
|
||||
|
||||
|
@ -84,6 +92,8 @@ def check(hosts):
|
|||
print("#" * 64)
|
||||
|
||||
for host in hosts:
|
||||
print(host.rjust(hostwidth + 1), end=" ", flush=True)
|
||||
|
||||
current_sys, cur_kernel, boot_kernel = (
|
||||
run(
|
||||
[
|
||||
|
@ -105,8 +115,6 @@ def check(hosts):
|
|||
reboot_needed = cur_kernel != boot_kernel
|
||||
update_needed = current_sys != new_sys[host]
|
||||
|
||||
print(host.rjust(hostwidth + 1), end=" ")
|
||||
|
||||
if not (reboot_needed or update_needed):
|
||||
print(icon_good, "[OK]")
|
||||
continue
|
||||
|
@ -142,9 +150,9 @@ def push(hosts):
|
|||
def rexec(hosts, cmd):
|
||||
hostwidth = max(map(len, hosts))
|
||||
for host in hosts:
|
||||
print(host.rjust(hostwidth), end=" ", flush=True)
|
||||
r = run(["ssh", host, "--"] + cmd, stdout=PIPE, stderr=STDOUT)
|
||||
lines = r.stdout.decode("utf8").strip("\n").splitlines()
|
||||
print(host.rjust(hostwidth), end=" ")
|
||||
print(icon_bad if r.returncode else icon_good, end=" ")
|
||||
if len(lines) == 1:
|
||||
print(lines[0])
|
||||
|
|
Loading…
Reference in a new issue