generated from john/nix-docker
Compare commits
37 Commits
a6348adef1
...
reorg_roun
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afe391ef8e | ||
|
|
fdb9d8717d | ||
|
|
857aedca79 | ||
|
|
3edc60fe84 | ||
|
|
7a1a40c2ae | ||
|
|
d22763540a | ||
|
|
fd21e90e1d | ||
|
|
138df54fbc | ||
|
|
30c43f5488 | ||
|
|
343c6a89db | ||
|
|
9334d2cc7f | ||
|
|
9d4c47682b | ||
|
|
e397231579 | ||
|
|
add8fca4b0 | ||
|
|
b973c002e1 | ||
|
|
6e891cc6da | ||
|
|
6dfa38cc5e | ||
|
|
b16ab9e230 | ||
|
|
fc2ef9344e | ||
|
|
50bb31a670 | ||
|
|
5233efa8ba | ||
|
|
ee521c87eb | ||
|
|
7667011dbf | ||
|
|
6bf90e6b24 | ||
|
|
36cf352c67 | ||
|
|
2a00037711 | ||
|
|
38c7effc93 | ||
|
|
fee9256b39 | ||
|
|
41bf8a074e | ||
|
|
68bfa4ef4b | ||
|
|
3121bffc30 | ||
|
|
a3179e52d7 | ||
|
|
679f8bfca0 | ||
|
|
f303b9ec57 | ||
|
|
dd3de3c145 | ||
|
|
d741b62d2c | ||
|
|
4e87f3119f |
@@ -1,22 +1,10 @@
|
|||||||
{ pkgs, lib, modulesPath, ... }:
|
{ pkgs, userSettings, systemSettings, ... }:
|
||||||
let
|
|
||||||
stateVersion = "24.05";
|
|
||||||
userName = "loki";
|
|
||||||
repoPath = "/srv/loki";
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
system.stateVersion = stateVersion;
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
# time.timeZone = "America/Chicago";
|
|
||||||
|
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
(pkgs.writeShellScriptBin "nrbs" "sudo nixos-rebuild switch")
|
# (pkgs.writeShellScriptBin "nrbs" "sudo nixos-rebuild switch")
|
||||||
(pkgs.writeShellScriptBin "nrbsu" "sudo nix-channel --update && sudo nixos-rebuild switch")
|
# (pkgs.writeShellScriptBin "nrbsu" "sudo nix-channel --update && sudo nixos-rebuild switch")
|
||||||
bash
|
bash
|
||||||
busybox
|
busybox
|
||||||
git
|
git
|
||||||
@@ -35,4 +23,14 @@ in
|
|||||||
execWheelOnly = false;
|
execWheelOnly = false;
|
||||||
wheelNeedsPassword = false; # allows sudo without password for those in the wheel group
|
wheelNeedsPassword = false; # allows sudo without password for those in the wheel group
|
||||||
};
|
};
|
||||||
|
|
||||||
|
users.users.${userSettings.username} = {
|
||||||
|
isNormalUser = true;
|
||||||
|
uid = 1000;
|
||||||
|
extraGroups = [ "wheel" "networkmanager" ];
|
||||||
|
openssh.authorizedKeys.keyFiles = [ /root/.ssh/authorized_keys ];
|
||||||
|
};
|
||||||
|
|
||||||
|
time.timeZone = "${systemSettings.timeZone}";
|
||||||
|
networking.hostName = systemSettings.hostName;
|
||||||
}
|
}
|
||||||
|
|||||||
16
flake.lock
generated
16
flake.lock
generated
@@ -40,17 +40,18 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1733392399,
|
"lastModified": 1733581040,
|
||||||
"narHash": "sha256-kEsTJTUQfQFIJOcLYFt/RvNxIK653ZkTBIs4DG+cBns=",
|
"narHash": "sha256-Qn3nPMSopRQJgmvHzVqPcE3I03zJyl8cSbgnnltfFDY=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d0797a04b81caeae77bcff10a9dde78bc17f5661",
|
"rev": "22c3f2cf41a0e70184334a958e6b124fb0ce3e01",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-unstable",
|
"ref": "nixos-unstable",
|
||||||
"type": "indirect"
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
@@ -63,9 +64,10 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-24.11",
|
"ref": "nixos-24.11",
|
||||||
"type": "indirect"
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
|
|||||||
78
flake.nix
78
flake.nix
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
description = "Loki flake config";
|
description = "Panoptes flake config";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
nixpkgs-stable.url = "nixpkgs/nixos-24.11";
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@@ -16,50 +16,66 @@
|
|||||||
nixpkgs,
|
nixpkgs,
|
||||||
nixpkgs-stable,
|
nixpkgs-stable,
|
||||||
home-manager,
|
home-manager,
|
||||||
vscode-server,
|
|
||||||
...
|
...
|
||||||
} @ inputs:
|
} @ inputs:
|
||||||
let
|
let
|
||||||
|
stateVersion = "24.11";
|
||||||
inherit (self) outputs;
|
inherit (self) outputs;
|
||||||
system = "x86_64-linux";
|
nixosSystem = inputs.nixpkgs.lib.nixosSystem;
|
||||||
timeZone = "America/Chicago";
|
|
||||||
hostname = "loki";
|
userSettings = rec {
|
||||||
lokiUser = "loki";
|
username = "panoptes";
|
||||||
lokiPath = "/srv/loki";
|
gitUserName = "John Lancaster";
|
||||||
|
gitUserEmail = "32917998+jsl12@users.noreply.github.com";
|
||||||
|
# gitUserEmail = "asdfasdf@asdf.com";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemSettings = rec {
|
||||||
|
hostName = "panoptes-nix";
|
||||||
|
system = "x86_64-linux";
|
||||||
|
timeZone = "America/Chicago";
|
||||||
|
locale = "en_US.UTF-8";
|
||||||
|
};
|
||||||
|
|
||||||
|
pkgs = inputs.nixpkgs.legacyPackages.${systemSettings.system};
|
||||||
|
pkgs-stable = inputs.nixpkgs-stable.legacyPackages.${systemSettings.system};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
# FIXME replace with your hostname
|
"${systemSettings.hostName}" = nixosSystem {
|
||||||
${hostname} = nixpkgs.lib.nixosSystem {
|
system = systemSettings.system;
|
||||||
system = "${system}";
|
specialArgs = {
|
||||||
# time.timeZone = "${timeZone}";
|
inherit inputs;
|
||||||
specialArgs = {inherit inputs outputs;};
|
inherit outputs;
|
||||||
|
inherit userSettings;
|
||||||
|
inherit systemSettings;
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
./configuration.nix # > Our main nixos configuration file <
|
./configuration.nix # > Our main nixos configuration file <
|
||||||
vscode-server.nixosModules.default
|
"${inputs.nixpkgs}/nixos/modules/virtualisation/proxmox-lxc.nix"
|
||||||
({ config, pkgs, ... }: {services.vscode-server.enable = true;})
|
({ ... }: {
|
||||||
|
system.stateVersion = "${stateVersion}";
|
||||||
|
services.vscode-server.enable = true;
|
||||||
|
})
|
||||||
|
inputs.vscode-server.nixosModules.default
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Standalone home-manager configuration entrypoint
|
|
||||||
# Available through 'home-manager --flake .#your-username@your-hostname'
|
|
||||||
homeConfigurations = {
|
homeConfigurations = {
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
"root@${hostname}" = home-manager.lib.homeManagerConfiguration {
|
"panoptes@panoptes-nix" = home-manager.lib.homeManagerConfiguration {
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
inherit pkgs stateVersion;
|
||||||
extraSpecialArgs = {inherit inputs outputs;};
|
specialArgs = {
|
||||||
modules = [(import ./git.nix { repoPath = "${lokiPath}"; })];
|
inherit inputs;
|
||||||
};
|
inherit outputs;
|
||||||
|
inherit userSettings;
|
||||||
# FIXME replace with your username@hostname
|
inherit systemSettings;
|
||||||
"${lokiUser}@${hostname}" = home-manager.lib.homeManagerConfiguration {
|
};
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
|
||||||
extraSpecialArgs = {inherit inputs outputs;};
|
|
||||||
# > Our main home-manager configuration file <
|
|
||||||
modules = [
|
modules = [
|
||||||
(import ./home.nix { user = "${lokiUser}"; repoPath = "${lokiPath}"; })
|
./home.nix
|
||||||
(import ./git.nix { repoPath = "${lokiPath}"; })
|
# ({...}: {home.stateVersion = "${stateVersion}";})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
10
git.nix
10
git.nix
@@ -1,10 +0,0 @@
|
|||||||
{ repoPath, ... }:
|
|
||||||
{
|
|
||||||
programs.git = {
|
|
||||||
enable = true;
|
|
||||||
extraConfig.safe.directory = "${repoPath}";
|
|
||||||
extraConfig.credential.helper = "store --file ~/.git-credentials";
|
|
||||||
userName = "John Lancaster";
|
|
||||||
userEmail = "32917998+jsl12@users.noreply.github.com";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
42
home.nix
42
home.nix
@@ -1,9 +1,41 @@
|
|||||||
{ user, repoPath, ... }:
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
systemSettings,
|
||||||
|
userSettings,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
homePath = "/srv/panoptes";
|
||||||
|
repoURL = "https://gitea.john-stream.com/john/loki-nix";
|
||||||
|
repoBranch = "reorg";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
home = {
|
|
||||||
stateVersion = "24.05";
|
programs.git = {
|
||||||
username = "${user}";
|
enable = true;
|
||||||
homeDirectory = "${repoPath}";
|
extraConfig.credential.helper = "store --file ~/.git-credentials";
|
||||||
|
userName = "${userSettings.gitUserName}";
|
||||||
|
userEmail = "${userSettings.gitUserEmail}";
|
||||||
|
extraConfig.safe.directory = "${homePath}";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.bash.enable = true;
|
||||||
|
programs.ssh.enable = true;
|
||||||
|
|
||||||
|
home = {
|
||||||
|
homeDirectory = "${homePath}";
|
||||||
|
packages = [
|
||||||
|
(pkgs.writeShellScriptBin "nfs" ''
|
||||||
|
sudo nixos-rebuild switch --flake ${homePath}#${hostName} --impure
|
||||||
|
'')
|
||||||
|
(pkgs.writeShellScriptBin "init-panoptes" ''
|
||||||
|
sudo -u git clone -b ${repoBranch} ${repoURL} /srv/panoptes
|
||||||
|
'')
|
||||||
|
git
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.user.startServices = "sd-switch";
|
||||||
}
|
}
|
||||||
19
nixosModules/default.nix
Normal file
19
nixosModules/default.nix
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
inputs,
|
||||||
|
outputs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports =
|
||||||
|
[
|
||||||
|
./services/loki.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
config = {
|
||||||
|
nix.settings.experimental-features = ["nix-command" "flakes"];
|
||||||
|
programs.nix-ld.enable = true;
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,21 +1,22 @@
|
|||||||
{ pkgs, userName, ... }:
|
{ pkgs, config, ... }:
|
||||||
let
|
|
||||||
lokiPort = 3100;
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
networking.firewall.allowedTCPPorts = [ lokiPort ];
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
config.services.loki.configuration.server.http_listen_port
|
||||||
|
];
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
(pkgs.writeShellScriptBin "loki-check" "curl http://localhost:3100/ready")
|
(pkgs.writeShellScriptBin "loki-check" ''
|
||||||
(pkgs.writeShellScriptBin "loki-logs" "journalctl -b -u loki.service -n 25")
|
curl http://localhost:${config.services.loki.configuration.server.http_listen_port}/ready
|
||||||
|
'')
|
||||||
|
(pkgs.writeShellScriptBin "loki-logs" "journalctl -b -u loki.service -n 10")
|
||||||
];
|
];
|
||||||
|
|
||||||
services.loki = {
|
services.loki = {
|
||||||
enable = true;
|
enable = true;
|
||||||
user = "${userName}";
|
user = "loki";
|
||||||
|
|
||||||
configuration = {
|
configuration = {
|
||||||
server.http_listen_port = lokiPort;
|
server.http_listen_port = 3100;
|
||||||
# server.grpc_listen_port = 9096;
|
# server.grpc_listen_port = 9096;
|
||||||
auth_enabled = false;
|
auth_enabled = false;
|
||||||
|
|
||||||
14
vscode.nix
14
vscode.nix
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
inputs.vscode-server.url = "github:nix-community/nixos-vscode-server";
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs, vscode-server }: {
|
|
||||||
nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem {
|
|
||||||
modules = [
|
|
||||||
vscode-server.nixosModules.default
|
|
||||||
({ config, pkgs, ... }: {
|
|
||||||
services.vscode-server.enable = true;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user