big refactor
This commit is contained in:
108
flake.nix
108
flake.nix
@@ -1,7 +1,6 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
@@ -11,6 +10,19 @@
|
||||
url = "github:Mic92/sops-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
nixpkgs-python = {
|
||||
url = "github:cachix/nixpkgs-python";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
devenv = {
|
||||
url = "github:cachix/devenv";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
nixConfig = {
|
||||
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
|
||||
extra-substituters = "https://devenv.cachix.org";
|
||||
};
|
||||
|
||||
outputs = { self, ... }@args:
|
||||
@@ -19,17 +31,21 @@
|
||||
nixosSystem = args.nixpkgs.lib.nixosSystem;
|
||||
|
||||
userSettings = {
|
||||
username = "panoptes";
|
||||
userName = "appdaemon";
|
||||
gitUserName = "John Lancaster";
|
||||
gitUserEmail = "32917998+jsl12@users.noreply.github.com";
|
||||
adRepo = "https://github.com/jsl12/appdaemon";
|
||||
adBranch = "hass";
|
||||
adHome = "/srv/appdaemon";
|
||||
};
|
||||
|
||||
systemSettings = {
|
||||
hostName = "ad-nix";
|
||||
stateVersion = "24.11";
|
||||
stateVersion = "24.05";
|
||||
system = "x86_64-linux";
|
||||
timeZone = "America/Chicago";
|
||||
locale = "en_US.UTF-8";
|
||||
pythonVersion = "3.12.7";
|
||||
};
|
||||
|
||||
pkgs = args.nixpkgs.legacyPackages.${systemSettings.system};
|
||||
@@ -38,30 +54,88 @@
|
||||
{
|
||||
nixosConfigurations.${systemSettings.hostName} = nixosSystem {
|
||||
system = systemSettings.system;
|
||||
specialArgs = {
|
||||
specialArgs =
|
||||
let
|
||||
inputs = args;
|
||||
in
|
||||
{
|
||||
inherit inputs;
|
||||
inherit systemSettings;
|
||||
inherit userSettings;
|
||||
};
|
||||
modules = [
|
||||
(args.nixpkgs + "/nixos/modules/virtualisation/proxmox-lxc.nix")
|
||||
./configuration.nix
|
||||
args.home-manager.nixosModules.default
|
||||
args.vscode-server.nixosModules.default
|
||||
args.sops-nix.nixosModules.sops
|
||||
({ ... }: { services.vscode-server.enable = true; })
|
||||
./configuration.nix
|
||||
];
|
||||
};
|
||||
|
||||
# homeConfigurations = {
|
||||
# useGlobalPkgs = true;
|
||||
# ${userSettings.username} = args.home-manager.lib.homeManagerConfiguration {
|
||||
# inherit pkgs;
|
||||
# extraSpecialArgs = {
|
||||
# inherit systemSettings;
|
||||
# inherit userSettings;
|
||||
# };
|
||||
# modules = [ ./home.nix ];
|
||||
# };
|
||||
# };
|
||||
packages.${systemSettings.system} = {
|
||||
devenv-up = self.devShells.${systemSettings.system}.default.config.procfileScript;
|
||||
devenv-test = self.devShells.${systemSettings.system}.default.config.test;
|
||||
};
|
||||
|
||||
devShells.${systemSettings.system}.default =
|
||||
let
|
||||
inputs = args;
|
||||
in
|
||||
args.devenv.lib.mkShell {
|
||||
inherit inputs pkgs;
|
||||
modules = [
|
||||
({ pkgs, config, ... }: {
|
||||
# This is your devenv configuration
|
||||
|
||||
pre-commit.hooks = {
|
||||
end-of-file-fixer.enable = true;
|
||||
trim-trailing-whitespace.enable = true;
|
||||
};
|
||||
|
||||
languages.python = {
|
||||
enable = true;
|
||||
version = systemSettings.pythonVersion;
|
||||
uv = {
|
||||
enable = true;
|
||||
sync = {
|
||||
enable = true;
|
||||
allExtras = true;
|
||||
arguments = [ "-U" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
packages = with pkgs; [
|
||||
git
|
||||
# (writeShellScriptBin "full-build" ''
|
||||
# cd ${adPath}
|
||||
# ${pkgs.uv}/bin/uv build --wheel
|
||||
# docker build -t acockburn/appdaemon:local-dev ${adPath}
|
||||
# '')
|
||||
# (pkgs.python312.withPackages (python-pkgs: with python-pkgs; [
|
||||
# pip
|
||||
# setuptools
|
||||
# wheel
|
||||
# ipykernel
|
||||
# rich
|
||||
# ]))
|
||||
];
|
||||
|
||||
enterShell = ''
|
||||
alias appdaemon="${pkgs.uv}/bin/uv run --frozen python -m appdaemon"
|
||||
alias ad="appdaemon"
|
||||
|
||||
export PS1="\[\e[0;34m\](AppDaemon)\[\e[0m\] ''${PS1-}"
|
||||
|
||||
export VIRTUAL_ENV=$UV_PROJECT_ENVIRONMENT
|
||||
|
||||
echo -e "URL: \e[34m$(${pkgs.git}/bin/git config --get remote.origin.url)\e[0m"
|
||||
echo -e "Branch: \e[32m$(${pkgs.git}/bin/git rev-parse --abbrev-ref HEAD)\e[0m"
|
||||
echo -e "Hash: \e[33m$(${pkgs.git}/bin/git rev-parse --short HEAD)\e[0m"
|
||||
echo "AppDaemon v$(${pkgs.uv}/bin/uv pip show appdaemon | awk '/^Version:/ {print $2}') development shell started"
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user