Skip to content

Commit

Permalink
Update flake: use flake-parts
Browse files Browse the repository at this point in the history
  • Loading branch information
LovingMelody committed Jan 5, 2025
1 parent 138c803 commit f9fea4e
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 37 deletions.
23 changes: 22 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

137 changes: 105 additions & 32 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,115 @@
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
systems.url = "github:nix-systems/default";
};

outputs =
{ self, systems, ... }@inputs:
with inputs;
let
eachSystem =
f:
nixpkgs.lib.genAttrs (import systems) (
system: f (nixpkgs.legacyPackages.${system}.extend self.overlays.default)
);
treefmtEval = eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
in
{
overlays.default = (import ./overlays.nix) inputs;
nixosModules.StarCitizen = (import ./modules/nixos/star-citizen) self;
formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
checks = eachSystem (pkgs: {
formatting = treefmtEval.${pkgs.system}.config.build.check self;
});
packages = eachSystem (pkgs: {
inherit (pkgs)
star-citizen-helper
lug-helper
star-citizen
star-citizen-umu
dxvk-gplasync
umu
winetricks-git
;
});
githubActions = nix-github-actions.lib.mkGithubMatrix {
checks =
(nixpkgs.lib.getAttrs [ "x86_64-linux" ] self.checks)
// (nixpkgs.lib.getAttrs [ "x86_64-linux" ] self.packages);
inputs@{ flake-parts, self, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.flake-parts.flakeModules.easyOverlay
inputs.flake-parts.flakeModules.modules
inputs.treefmt-nix.flakeModule
];
systems = [ "x86_64-linux" ];
flake = {

githubActions = inputs.nix-github-actions.lib.mkGithubMatrix {
checks =
(inputs.nixpkgs.lib.getAttrs [ "x86_64-linux" ] self.checks)
// (inputs.nixpkgs.lib.getAttrs [ "x86_64-linux" ] self.packages);
};
modules = {
nixos = {
StarCitizen = import ./modules/nixos/star-citizen;
};
};
};
perSystem =
{
config,
system,
pkgs,
...
}:
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
overlayAttrs = config.packages;
packages =
let
pins = import ./npins;
in
{
star-citizen-helper = pkgs.callPackage ./pkgs/star-citizen-helper { };

dxvk-gplasync =
let
inherit (pins) dxvk-gplasync;
inherit (dxvk-gplasync) version;
in
pkgs.dxvk.overrideAttrs (old: {
name = "dxvk-gplasync";
inherit version;
patches = [
"${dxvk-gplasync}/patches/dxvk-gplasync-${version}.patch"
"${dxvk-gplasync}/patches/global-dxvk.conf.patch"
] ++ old.patches or [ ];
});

lug-helper =
let
pkg = pkgs.callPackage ./pkgs/lug-helper { };
in
# We only use the local lug-helper if nixpkgs doesn't have it
# And if the nixpkgs version isnt older than local
if (builtins.hasAttr "lug-helper" pkgs) then
if (inputs.nixpkgs.lib.strings.versionOlder pkgs.lug-helper.version pkg.version) then
pkg
else
pkgs.lug-helper
else
pkg;
inherit (inputs.nix-gaming.packages.${system})
star-citizen
star-citizen-umu
umu
winetricks-git
;

};
treefmt = {
# Project root
projectRootFile = "flake.nix";
# Terraform formatter
programs = {
yamlfmt.enable = true;
nixfmt.enable = true;
deno.enable = true;
deadnix = {
enable = true;
# Can break callPackage if this is set to false
no-lambda-pattern-names = true;
};
statix.enable = true;
rustfmt.enable = true;
beautysh.enable = true;
};
settings.formatter = {
deadnix.excludes = [ "npins/default.nix" ];
nixfmt.excludes = [ "npins/default.nix" ];
deno.excludes = [ "npins/default.nix" ];
statix.excludes = [ "npins/default.nix" ];
yamlfmt.excludes = [ "npins/sources.json" ];
};
};
};
};
}
8 changes: 4 additions & 4 deletions npins/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"version": "v2.5.1-2",
"revision": "649caf102bd808479c8c0db03283bceb05a0f75e",
"url": "https://gitlab.com/api/v4/projects/Ph42oN%2Fdxvk-gplasync/repository/archive.tar.gz?ref=v2.5.1-2",
"hash": "1b799rpq0jxwsp1dqnyjyp9q3pj628si89nyl6c8vqdjgfisz70n"
"version": "v2.5.2-1",
"revision": "c78b2f4145c8ae659e71a9679283dbf9653b1dc9",
"url": "https://gitlab.com/api/v4/projects/Ph42oN%2Fdxvk-gplasync/repository/archive.tar.gz?ref=v2.5.2-1",
"hash": "1xighpbng4askf9yhyvaz6xgv4a8vh1rjskj09dv9agivnsj239s"
}
},
"version": 3
Expand Down

0 comments on commit f9fea4e

Please sign in to comment.