Skip to content

Commit

Permalink
Merge pull request #12 from Ruixi-rebirth/master
Browse files Browse the repository at this point in the history
优化flake
  • Loading branch information
yaocccc committed Feb 10, 2023
2 parents ba04fc5 + 7466d7e commit 95af3c6
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 24 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,32 @@ exec dwm
```sh
nix run github:yaocccc/dwm
```
下面是在 nixos configuration中使用它的示例
```nix
{
description = "My configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
dwm.url = "./dwm";
};
outputs = { nixpkgs, dwm, ... }:
{
nixosConfigurations = {
hostname = nixpkgs.lib.nixosSystem
{
system = "x86_64-linux";
modules = [
{
nixpkgs.overlays = [ dwm.overlays.default ];
}
];
};
};
};
}
```

## 状态栏

Expand Down
7 changes: 4 additions & 3 deletions flake.lock

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

68 changes: 47 additions & 21 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,27 +1,53 @@
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

inputs.flake-utils.url = "github:numtide/flake-utils";

outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in rec {
packages = flake-utils.lib.flattenTree {
dwm = pkgs.dwm.overrideAttrs (old: {
src = pkgs.lib.cleanSource self;
outputs =
{ self
, nixpkgs
, flake-utils
,
}:
let
overlay =
final: prev: {
dwm = prev.dwm.overrideAttrs (oldAttrs: rec {
postPatch = (oldAttrs.postPatch or "") + ''
cp -r DEF/* .
'';
version = "master";
src = ./.;
});
};
defaultPackage = packages.dwm;
apps.default = flake-utils.lib.mkApp {
drv = packages.dwm;
exePath = "/bin/dwm";
};
}
);
in
flake-utils.lib.eachDefaultSystem
(
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
self.overlays.default
];
};
in
rec {
# apps = {
# dwm = {
# type = "app";
# program = "${packages.default}/bin/st";
# };
# };
packages.dwm = pkgs.dwm;
# apps.default = apps.dwm;
packages.default = pkgs.dwm;
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ xorg.libX11 xorg.libXft xorg.libXinerama gcc ];
};
}
)
// { overlays.default = overlay; };
}

0 comments on commit 95af3c6

Please sign in to comment.