2020-04-27 03:21:12 +04:00
|
|
|
{
|
2020-04-27 05:39:00 +04:00
|
|
|
description =
|
|
|
|
"A collection of crap, hacks and copy-paste to make my localhosts boot";
|
2020-04-27 03:21:12 +04:00
|
|
|
|
2021-07-27 20:39:06 +04:00
|
|
|
nixConfig.substituters = [ "https://cache.nixos.org" ];
|
|
|
|
|
2020-06-21 13:17:20 +04:00
|
|
|
inputs = {
|
2021-01-21 22:13:53 +04:00
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
2021-11-11 18:54:36 +04:00
|
|
|
nix.url = "github:nixos/nix";
|
2021-01-21 22:13:53 +04:00
|
|
|
lambda-launcher.url = "github:balsoft/lambda-launcher";
|
2021-01-23 23:21:51 +04:00
|
|
|
deploy-rs.url = "github:serokell/deploy-rs";
|
2021-03-10 19:53:44 +04:00
|
|
|
flake-compat = {
|
|
|
|
url = "github:edolstra/flake-compat";
|
|
|
|
flake = false;
|
|
|
|
};
|
2020-06-21 13:17:20 +04:00
|
|
|
NUR = {
|
2021-01-21 22:13:53 +04:00
|
|
|
url = "github:nix-community/NUR";
|
2020-06-21 13:17:20 +04:00
|
|
|
flake = false;
|
|
|
|
};
|
2021-06-10 19:58:51 +04:00
|
|
|
base16-black-metal-scheme = {
|
|
|
|
url = "github:metalelf0/base16-black-metal-scheme";
|
2020-06-21 13:17:20 +04:00
|
|
|
flake = false;
|
|
|
|
};
|
2021-01-21 22:13:53 +04:00
|
|
|
home-manager.url = "github:rycee/home-manager";
|
2020-06-21 13:17:20 +04:00
|
|
|
materia-theme = {
|
2021-01-21 22:13:53 +04:00
|
|
|
url = "github:nana-4/materia-theme";
|
2020-06-21 13:17:20 +04:00
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
nixpkgs-old = {
|
2021-01-21 22:13:53 +04:00
|
|
|
url = "github:nixos/nixpkgs/nixos-19.09";
|
2020-06-21 13:17:20 +04:00
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
simple-nixos-mailserver = {
|
2020-11-10 02:07:06 +04:00
|
|
|
url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
|
2020-06-21 13:17:20 +04:00
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
nixpkgs-wayland = {
|
2021-01-21 22:13:53 +04:00
|
|
|
url = "github:colemickens/nixpkgs-wayland";
|
2020-06-21 13:17:20 +04:00
|
|
|
flake = false;
|
|
|
|
};
|
2021-01-21 22:13:53 +04:00
|
|
|
nixos-fhs-compat.url = "github:balsoft/nixos-fhs-compat";
|
|
|
|
simple-osd-daemons.url = "github:balsoft/simple-osd-daemons";
|
2021-03-18 18:10:07 +04:00
|
|
|
sonoff-lan = {
|
|
|
|
url = "github:AlexxIT/SonoffLAN";
|
|
|
|
flake = false;
|
|
|
|
};
|
2021-03-30 15:05:31 +04:00
|
|
|
crdt = {
|
|
|
|
url = "git+https://code.librehq.com/qhong/crdt.el";
|
|
|
|
flake = false;
|
|
|
|
};
|
2021-06-08 20:35:21 +04:00
|
|
|
impermanence.url = "github:nix-community/impermanence";
|
2021-06-10 19:58:51 +04:00
|
|
|
|
|
|
|
rycee = {
|
|
|
|
url = "gitlab:rycee/nur-expressions";
|
|
|
|
flake = false;
|
|
|
|
};
|
2021-06-17 23:39:12 +04:00
|
|
|
|
2021-06-24 12:41:17 +04:00
|
|
|
nix-direnv = { url = "github:nix-community/nix-direnv"; };
|
2021-06-19 00:48:50 +04:00
|
|
|
|
|
|
|
nheko = {
|
2021-06-27 09:17:17 +04:00
|
|
|
url = "github:nheko-reborn/nheko";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
|
2021-12-23 22:23:03 +04:00
|
|
|
mtxclient = {
|
2021-06-27 09:17:17 +04:00
|
|
|
url = "github:nheko-reborn/mtxclient";
|
2021-06-19 00:48:50 +04:00
|
|
|
flake = false;
|
|
|
|
};
|
2021-09-12 22:46:19 +04:00
|
|
|
|
2021-09-13 21:03:07 +04:00
|
|
|
coeurl = {
|
|
|
|
url = "git+https://nheko.im/nheko-reborn/coeurl";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
|
2021-09-12 22:46:19 +04:00
|
|
|
mopidy-ytmusic = {
|
|
|
|
url = "github:OzymandiasTheGreat/mopidy-ytmusic";
|
|
|
|
flake = false;
|
|
|
|
};
|
2021-12-05 16:07:20 +04:00
|
|
|
|
|
|
|
brother-hl-3170cdw-driver = {
|
|
|
|
url = "github:balsoft/brother-hl-3170cdw-driver";
|
|
|
|
flake = false;
|
|
|
|
};
|
2022-05-30 14:12:15 +04:00
|
|
|
|
2022-07-18 14:19:35 +04:00
|
|
|
codebraid = {
|
|
|
|
url = "github:gpoore/codebraid";
|
|
|
|
flake = false;
|
|
|
|
};
|
2022-09-01 18:23:59 +04:00
|
|
|
|
|
|
|
flake-registry = {
|
|
|
|
url = "github:nixos/flake-registry";
|
|
|
|
flake = false;
|
|
|
|
};
|
2022-11-14 10:44:09 +04:00
|
|
|
|
|
|
|
nix-vscode-marketplace.url = "github:AmeerTaweel/nix-vscode-marketplace";
|
2023-01-06 15:19:00 +04:00
|
|
|
|
|
|
|
remapper.url = "github:balsoft/remapper";
|
2023-02-07 13:06:46 +04:00
|
|
|
|
|
|
|
helix.url = "github:helix-editor/helix";
|
2023-02-07 17:00:04 +04:00
|
|
|
|
|
|
|
tridactyl-native-messenger = {
|
|
|
|
url = "github:tridactyl/native_messenger";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
|
2023-02-16 18:51:34 +04:00
|
|
|
nixos-hardware.url = "github:balsoft/nixos-hardware/add-librem-5";
|
2023-02-22 00:34:25 +04:00
|
|
|
|
|
|
|
yt-dlp.url = "github:yt-dlp/yt-dlp";
|
|
|
|
yt-dlp.flake = false;
|
2020-06-21 13:17:20 +04:00
|
|
|
};
|
2020-04-27 03:21:12 +04:00
|
|
|
|
2021-07-07 15:44:12 +04:00
|
|
|
outputs = { nixpkgs, self, nix, deploy-rs, ... }@inputs:
|
2021-06-24 12:41:17 +04:00
|
|
|
let
|
|
|
|
findModules = dir:
|
|
|
|
builtins.concatLists (builtins.attrValues (builtins.mapAttrs
|
|
|
|
(name: type:
|
2021-12-23 22:23:03 +04:00
|
|
|
if type == "regular" then [{
|
|
|
|
name = builtins.elemAt (builtins.match "(.*)\\.nix" name) 0;
|
|
|
|
value = dir + "/${name}";
|
|
|
|
}] else if (builtins.readDir (dir + "/${name}"))
|
2021-06-24 12:41:17 +04:00
|
|
|
? "default.nix" then [{
|
|
|
|
inherit name;
|
|
|
|
value = dir + "/${name}";
|
|
|
|
}] else
|
|
|
|
findModules (dir + "/${name}")) (builtins.readDir dir)));
|
2021-12-23 22:23:03 +04:00
|
|
|
pkgsFor = system:
|
|
|
|
import inputs.nixpkgs {
|
2022-05-30 14:12:15 +04:00
|
|
|
overlays = [ self.overlay ];
|
2021-12-23 22:23:03 +04:00
|
|
|
localSystem = { inherit system; };
|
2023-07-11 13:15:11 +04:00
|
|
|
config = {
|
|
|
|
android_sdk.accept_license = true;
|
|
|
|
permittedInsecurePackages = [ "openssl-1.1.1u" ];
|
|
|
|
};
|
2021-12-23 22:23:03 +04:00
|
|
|
};
|
2021-06-24 12:41:17 +04:00
|
|
|
in {
|
|
|
|
nixosModules = builtins.listToAttrs (findModules ./modules);
|
2021-01-21 22:13:53 +04:00
|
|
|
|
2021-06-24 12:41:17 +04:00
|
|
|
nixosProfiles = builtins.listToAttrs (findModules ./profiles);
|
2021-01-21 22:13:53 +04:00
|
|
|
|
2021-06-24 12:41:17 +04:00
|
|
|
nixosRoles = import ./roles;
|
2020-07-03 12:59:36 +04:00
|
|
|
|
2021-06-24 12:41:17 +04:00
|
|
|
nixosConfigurations = with nixpkgs.lib;
|
|
|
|
let
|
|
|
|
hosts = builtins.attrNames (builtins.readDir ./machines);
|
2021-12-23 22:23:03 +04:00
|
|
|
|
2021-06-24 12:41:17 +04:00
|
|
|
mkHost = name:
|
2021-12-23 22:23:03 +04:00
|
|
|
let
|
2021-06-24 12:41:17 +04:00
|
|
|
system = builtins.readFile (./machines + "/${name}/system");
|
2021-12-23 22:23:03 +04:00
|
|
|
pkgs = pkgsFor system;
|
|
|
|
in nixosSystem {
|
|
|
|
inherit system;
|
2023-01-27 22:51:09 +04:00
|
|
|
modules = __attrValues self.nixosModules ++ [
|
2023-02-16 18:51:34 +04:00
|
|
|
inputs.home-manager.nixosModules.home-manager
|
|
|
|
|
2023-02-24 14:33:13 +04:00
|
|
|
{
|
|
|
|
disabledModules =
|
|
|
|
[ "services/x11/desktop-managers/plasma5.nix" ];
|
|
|
|
}
|
|
|
|
|
2021-12-23 22:23:03 +04:00
|
|
|
(import (./machines + "/${name}"))
|
|
|
|
{ nixpkgs.pkgs = pkgs; }
|
|
|
|
{ device = name; }
|
|
|
|
];
|
2021-06-24 12:41:17 +04:00
|
|
|
specialArgs = { inherit inputs; };
|
|
|
|
};
|
|
|
|
in genAttrs hosts mkHost;
|
2020-06-21 13:17:20 +04:00
|
|
|
|
2021-12-23 22:23:03 +04:00
|
|
|
legacyPackages.x86_64-linux = pkgsFor "x86_64-linux";
|
2021-01-23 23:21:51 +04:00
|
|
|
|
2021-06-24 12:41:17 +04:00
|
|
|
defaultApp = deploy-rs.defaultApp;
|
2021-03-10 19:53:44 +04:00
|
|
|
|
2021-12-23 22:23:03 +04:00
|
|
|
overlay = import ./overlay.nix inputs;
|
|
|
|
|
|
|
|
lib = import ./lib.nix nixpkgs.lib;
|
|
|
|
|
2021-06-24 12:41:17 +04:00
|
|
|
devShell.x86_64-linux = with nixpkgs.legacyPackages.x86_64-linux;
|
|
|
|
mkShell {
|
|
|
|
buildInputs = [
|
2022-06-21 17:39:08 +04:00
|
|
|
nix.packages.x86_64-linux.default
|
2021-06-24 12:41:17 +04:00
|
|
|
deploy-rs.defaultPackage.x86_64-linux
|
|
|
|
nixfmt
|
|
|
|
];
|
2023-02-16 18:51:34 +04:00
|
|
|
shellHook = ''
|
|
|
|
linkFile() {
|
|
|
|
source="$(nix build --print-out-paths "$1.source" || nix eval --raw "$1.source")"
|
|
|
|
target="$(nix eval --raw "$1.target")"
|
|
|
|
ln -fs "$source" "$HOME/$target"
|
|
|
|
}
|
|
|
|
linkHomeManagerFile() {
|
|
|
|
linkFile ".#nixosConfigurations.$(hostname).config.home-manager.users.$(whoami).$1"
|
|
|
|
}
|
|
|
|
linkConfigFile() {
|
|
|
|
linkHomeManagerFile "xdg.configFile.\"$1\""
|
|
|
|
}
|
|
|
|
linkDataFile() {
|
|
|
|
linkHomeManagerFile "xdg.dataFile.\"$1\""
|
|
|
|
}
|
|
|
|
linkHomeFile() {
|
|
|
|
linkHomeManagerFile "home.file.\"$1\""
|
|
|
|
}
|
|
|
|
'';
|
2021-06-15 00:00:45 +04:00
|
|
|
};
|
2021-06-24 12:41:17 +04:00
|
|
|
|
|
|
|
deploy = {
|
|
|
|
user = "root";
|
2021-11-06 13:06:38 +04:00
|
|
|
nodes = (builtins.mapAttrs (name: machine:
|
2021-12-23 22:23:03 +04:00
|
|
|
let activateable = name == "T420-Laptop" || name == "RasPi-Server";
|
|
|
|
in {
|
|
|
|
hostname = machine.config.networking.hostName;
|
|
|
|
profiles.system = {
|
|
|
|
user = if activateable then "root" else "balsoft";
|
|
|
|
path = with deploy-rs.lib.${machine.pkgs.system}.activate;
|
|
|
|
if activateable then
|
|
|
|
nixos machine
|
|
|
|
else
|
|
|
|
noop machine.config.system.build.toplevel;
|
|
|
|
};
|
|
|
|
}) self.nixosConfigurations);
|
2021-01-23 23:21:51 +04:00
|
|
|
};
|
2020-05-22 22:30:25 +04:00
|
|
|
};
|
2020-04-27 03:21:12 +04:00
|
|
|
}
|