mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +00:00
Compare commits
No commits in common. "0be59680b4e84546d3039824a7eeb69163559f84" and "e014507cd4845e7d7bee916b9f29ece7c740ce27" have entirely different histories.
0be59680b4
...
e014507cd4
8 changed files with 23 additions and 61 deletions
12
flake.lock
12
flake.lock
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"impermanence": {
|
||||
"locked": {
|
||||
"lastModified": 1717932370,
|
||||
"narHash": "sha256-7C5lCpiWiyPoIACOcu2mukn/1JRtz6HC/1aEMhUdcw0=",
|
||||
"lastModified": 1708968331,
|
||||
"narHash": "sha256-VUXLaPusCBvwM3zhGbRIJVeYluh2uWuqtj4WirQ1L9Y=",
|
||||
"owner": "nix-community",
|
||||
"repo": "impermanence",
|
||||
"rev": "27979f1c3a0d3b9617a3563e2839114ba7d48d3f",
|
||||
"rev": "a33ef102a02ce77d3e39c25197664b7a636f9c30",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -17,11 +17,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1718160348,
|
||||
"narHash": "sha256-9YrUjdztqi4Gz8n3mBuqvCkMo4ojrA6nASwyIKWMpus=",
|
||||
"lastModified": 1716948383,
|
||||
"narHash": "sha256-SzDKxseEcHR5KzPXLwsemyTR/kaM9whxeiJohbL04rs=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "57d6973abba7ea108bac64ae7629e7431e0199b6",
|
||||
"rev": "ad57eef4ef0659193044870c731987a6df5cf56b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
20
flake.nix
20
flake.nix
|
@ -14,20 +14,6 @@
|
|||
|
||||
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:
|
||||
|
@ -47,9 +33,13 @@
|
|||
|
||||
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,6 +43,8 @@
|
|||
|
||||
(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 "$@"
|
||||
''))
|
||||
|
@ -125,7 +127,6 @@
|
|||
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
|
||||
|
@ -162,6 +163,5 @@
|
|||
alias day='date "+%Y-%m-%d"'
|
||||
alias grep='grep --color=auto'
|
||||
alias tmp='cd "$(mktemp -d)"'
|
||||
alias nixpkgs='nix repl --file flake:nixpkgs'
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@ let
|
|||
"-jobs $(jobs -pr | wc -l)"
|
||||
];
|
||||
|
||||
termtitle = ''\[\e]0;\u@\h: \w\a\]'';
|
||||
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [
|
||||
|
@ -50,7 +48,7 @@ in
|
|||
local remote=y
|
||||
[ "$XDG_SESSION_TYPE" = "x11" ] && unset remote
|
||||
[ "$XDG_SESSION_TYPE" = "wayland" ] && unset remote
|
||||
PS1="${termtitle}$(powerline-go ${toString args})"
|
||||
PS1="$(powerline-go ${toString args})"
|
||||
}
|
||||
[ "$TERM" = "linux" ] || PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
|
||||
'';
|
||||
|
|
|
@ -18,6 +18,9 @@ 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,7 +11,6 @@
|
|||
extraGroups = [
|
||||
"audio"
|
||||
"dialout"
|
||||
"docker"
|
||||
"input"
|
||||
"networkmanager"
|
||||
"video"
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
{ 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,24 +27,16 @@ def get_deployment():
|
|||
def expand(ln):
|
||||
hosts = set()
|
||||
for item in ln.split(","):
|
||||
if item[0] == "-":
|
||||
item = item[1:]
|
||||
action = hosts.difference_update
|
||||
else:
|
||||
action = hosts.update
|
||||
|
||||
if item == "all":
|
||||
action(depl)
|
||||
hosts.update(depl)
|
||||
elif item in tags:
|
||||
action(name for name in depl if item in depl[name]["tags"])
|
||||
hosts.update(name for name in depl if item in depl[name]["tags"])
|
||||
else:
|
||||
action([item])
|
||||
|
||||
hosts.add(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)
|
||||
|
||||
|
||||
|
@ -92,8 +84,6 @@ def check(hosts):
|
|||
print("#" * 64)
|
||||
|
||||
for host in hosts:
|
||||
print(host.rjust(hostwidth + 1), end=" ", flush=True)
|
||||
|
||||
current_sys, cur_kernel, boot_kernel = (
|
||||
run(
|
||||
[
|
||||
|
@ -115,6 +105,8 @@ 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
|
||||
|
@ -150,9 +142,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